diff --git a/.circleci/config.yml b/.circleci/config.yml index 9f3940193f1..7bb844036e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,10 +12,7 @@ commands: # a reusable command with parameters # In many cases you can simplify this from what is generated here. # 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/' - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS - # This is based on your 1.0 configuration file or project settings - - run: - command: java -version - # Test + # Show jobId - run: name: "Setup custom environment variables" command: echo 'export CIRCLE_JOB_ID="<>"' >> $BASH_ENV @@ -137,6 +134,24 @@ jobs: key: javaClientMavenCache paths: - ~/.m2 + testKotlinClientSamples: + docker: + - image: cimg/openjdk:17.0.9 + working_directory: ~/OpenAPITools/openapi-json-schema-generator + shell: /bin/bash --login + environment: + CIRCLE_ARTIFACTS: /tmp/circleci-artifacts + CIRCLE_TEST_REPORTS: /tmp/circleci-test-results + steps: + - restore_cache: + keys: + - kotlinClientGradleCache + - command_build_and_test: + jobId: "testKotlinClientSamples" + - save_cache: + key: kotlinClientGradleCache + paths: + - ~/build workflows: version: 2 build: @@ -146,3 +161,4 @@ workflows: - testPython38ClientSamples - testPython39ClientSamples - testJava17ClientSamples + - testKotlinClientSamples diff --git a/.circleci/parallel.sh b/.circleci/parallel.sh index 804100e29eb..5085b172187 100755 --- a/.circleci/parallel.sh +++ b/.circleci/parallel.sh @@ -33,6 +33,13 @@ elif [ "$JOB_ID" = "testJava17ClientSamples" ]; then cat ./.circleci/testJava17ClientSamples.sh | parallel +elif [ "$JOB_ID" = "testKotlinClientSamples" ]; then + echo "Running job $JOB_ID ..." + gradle --version + java -version + + cat ./.circleci/testKotlinClientSamples.sh | parallel + else echo "Running job $JOB_ID" diff --git a/.circleci/testJava17ClientSamples.sh b/.circleci/testJava17ClientSamples.sh index bb5187fb8b3..41a29903f25 100644 --- a/.circleci/testJava17ClientSamples.sh +++ b/.circleci/testJava17ClientSamples.sh @@ -1,3 +1,3 @@ - (cd samples/client/petstore/java && gradle wrapper && gradle test) + (cd samples/client/petstore/java && gradle wrapper && ./gradlew test --no-daemon) (cd samples/client/3_0_3_unit_test/java && mvn test) (cd samples/client/3_1_0_unit_test/java && mvn test) \ No newline at end of file diff --git a/.circleci/testKotlinClientSamples.sh b/.circleci/testKotlinClientSamples.sh new file mode 100644 index 00000000000..d1a438304da --- /dev/null +++ b/.circleci/testKotlinClientSamples.sh @@ -0,0 +1,2 @@ + (cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test -info) + (cd samples/client/3_1_0_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test -info) \ No newline at end of file diff --git a/README.md b/README.md index dbe64fc7c44..31520b5cf87 100644 --- a/README.md +++ b/README.md @@ -15,89 +15,40 @@ so developers can use all of those features. Currently, the following languages/frameworks are supported: -- python (Stability: Stable) -- java (Stability: Stable) - -## Join Our Community -We use a Discord server as a place to ask questions and help each other. It offers functionality very similar to Slack. -You can join us here: https://discord.gg/mHB8WEQuYQ - -## Reasons To Use the Python Generator - -- v3.0.0 - [v3.1.0*](#openapi-v310-support) OpenAPI Specification support -- Type hints on - - schema payload inputs in SomeSchema.validate ![validate screen capture](docs/schema_validate.gif) - - Note: to make input dictionaries TypedDicts like the Money.validate example, set additionalProperties to false in the schema in your openapi document - - schema keyword argument inputs in `SomeSchemaDict.__new__` ![validate screen capture](docs/schemadict_new.gif) - - accessing properties in object instances so some_val in some_val = some_inst.someKey will have the correct type hint ![instance properties screen capture](docs/instance_properties.gif) - - accessing array items in array instances so some_val in some_val = array_inst[0] will have the correct type hint - - endpoint inputs + responses -- Run time type checking and validation checking when: - - instantiating models - - sending to endpoints - - receiving from endpoints - - Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class -- [mypy](samples/client/petstore/python/test_python.sh) runs on sample petstore client and passes - - passing mypy tests means that this generator could be ported into compiled languages like java/kotlin/golang -- [Autogenerated thorough testing of json schema keyword features in models and endpoints](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/tree/master/samples/client/3_0_3_unit_test/python/test) which come from the [json schema test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) -- [Tests are passing in CI](https://app.circleci.com/pipelines/github/openapi-json-schema-tools/openapi-json-schema-generator?branch=master) -- [Test endpoints are tagged by the relevant keyword like type/format/allOf 39 keywords and counting](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/tree/master/samples/client/3_1_0_unit_test/python/docs/apis/tags) -- Code re-use built in from the ground up - - components/schemas/headers etc are generated as separate classes and imported when used via $ref -- Openapi spec inline schemas supported at any depth in any location +| Feature | [Python](docs/generators/python.md) | [Java](docs/generators/java.md) | [Kotlin](docs/generators/kotlin.md) | +|----------------------------------------------------------------------------------------------------|-------------------------------------|---------------------------------|-------------------------------------| +| Generator status | stable | stable | experimental | +| Openapi v3.0.0-3.1.0 ingestion | X | X | X | +| Json Schema 2020-12 Support (components/schemas) | X | X | X | +| Component schemas documentation produced | X | X | X | +| Documentation produced for other component types:
headers, parameters,requestBodies, ressponses | X | X | | +| Endpoints that send/receive json + docs generated for them | X | X | | + +## Reasons To Use the Generators +- Openapi spec support for v3.0.0-3.1.0 + - thorough tests run in CI using json schema test suite, see 3_0_0 and 3_1_0 sample clients +- Static analysis: + - mypy run in CI against python petstore sample + - checker framework run w/ NullnessChecker, ensures no null pointer exceptions - Format support for: int32, int64, float, double, binary, date, datetime, uuid -- Invalid (in python) property names supported like `from`, `1var`, `hi-there` etc in +- Invalid (in language) property names supported like `from`, `1var`, `hi-there` etc in - schema property names - endpoint parameter names +- Openapi document inline schemas supported at any depth in any location +- Generated Code: Class + method inputs are typed +- Generated Code: Static type checking done in static languages suing builder inputs and class property access +- Generated Code: run-time type checking done in all generators (a payload can be validated against n schemas) +- Generated Code re-use built in from the ground up + - components/schemas/headers etc are generated as separate classes and imported when used via $ref - Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string -- types are generated for enums of type string/integer/boolean using typing.Literal - String transmission of numbers supported with type: string, format: number, value can be accessed as a Decimal with schemas.as_decimal(inst) - Multiple content types supported for request and response bodies -- Endpoint response always also includes the urllib3.HTTPResponse -- Endpoint response deserialization can be skipped with the skip_deserialization argument +- Endpoint response always also includes the raw response +- Interfaces kept consistent across generated languages -And many more! -- [Docs for the python generator](docs/generators/python.md) -- [generated client sample code](samples/client/petstore/python) - - [Openapi v3.0.3 general petstore spec, general features](src/test/resources/3_0/python/petstore_customized.yaml) -- [generated v3.1.0 unit test client sample code](samples/client/3_1_0_unit_test/python) - - [Openapi json schema v3.1.0 unit test spec](src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec.yaml) -- [generated v3.0.3 unit test client sample code](samples/client/3_0_3_unit_test/python) - - [Openapi json schema v3.0.3 unit test spec](src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml) - -## Reasons To Use the Java Generator - -- v3.0.0 - [v3.1.0](docs/generators/java.md#schema-feature) OpenAPI Specification support -- Documentation generated in the style of javadocs. Examples: [Money schema](samples/client/petstore/java/docs/components/schemas/Money.md#money1) [Pet.addPet endpoint](samples/client/petstore/java/docs/apis/tags/Pet.md#addpet) -- Sealed classes used to define endpoint responses/response bodies/validated schema payloads/request bodies -- Input types constrained for a Schema in SomeSchema.validate - - validate method can accept arbitrary List/Map/null/int/long/double/float/String json data -- Immutable List output classes generated and returned by validate for List<?> input -- Immutable Map output classes generated and returned by validate for Map<?, ?> input -- Strictly typed list input can be instantiated in client code using generated ListBuilders -- Strictly typed map input can be instantiated in client code using generated MapBuilders - - Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like: - - `new MapBuilder().requiredA("a").requiredB("b").build()` - - `new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()` -- Run time type checking and validation when - - validating schema payloads - - instantiating List output class (validation run) - - instantiating Map output class (validation run) - - Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class -- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods -- The [Checker-Framework's](https://github.com/typetools/checker-framework) NullnessChecker and @Nullable annotations are used in the java client - - ensuring that null pointer exceptions will not happen -- Invalid (in java) property names supported like `class`, `1var`, `hi-there` etc in - - component schema names - - schema property names (a fallback setter is written in the MapBuilder) -- Generated interfaces are largely consistent with the python code -- Openapi spec inline schemas supported at any depth in any location -- Format support for: int32, int64, float, double, date, datetime, uuid -- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string -- enum types are generated for enums of type string/integer/number/boolean/null -- String transmission of numbers supported with type: string, format: number -- [Autogenerated thorough testing of json schema keyword features in models and endpoints](samples/client/3_0_3_unit_test/java/src/test/java/org/openapijsonschematools/client/components/schemas) which come from the [json schema test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) -- [Tests are passing in CI](https://app.circleci.com/pipelines/github/openapi-json-schema-tools/openapi-json-schema-generator?branch=master) +## Join Our Community +We use a Discord server as a place to ask questions and help each other. It offers functionality very similar to Slack. +You can join us here: https://discord.gg/mHB8WEQuYQ And many more! - [Docs for the java generator](docs/generators/java.md) diff --git a/bin/generate_samples_configs/kotlin_3_0_3_unit_test.yaml b/bin/generate_samples_configs/kotlin_3_0_3_unit_test.yaml new file mode 100644 index 00000000000..75f12b901db --- /dev/null +++ b/bin/generate_samples_configs/kotlin_3_0_3_unit_test.yaml @@ -0,0 +1,6 @@ +generatorName: kotlin +outputDir: samples/client/3_0_3_unit_test/kotlin +inputSpec: src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec_nopaths.yaml +intsAllowedForFloatDoubleFormats: true +artifactId: unit-test-api +hideGenerationTimestamp: true \ No newline at end of file diff --git a/bin/generate_samples_configs/kotlin_3_1_0_unit_test.yaml b/bin/generate_samples_configs/kotlin_3_1_0_unit_test.yaml new file mode 100644 index 00000000000..de38ad3abb3 --- /dev/null +++ b/bin/generate_samples_configs/kotlin_3_1_0_unit_test.yaml @@ -0,0 +1,6 @@ +generatorName: kotlin +outputDir: samples/client/3_1_0_unit_test/kotlin +inputSpec: src/test/resources/3_1/unit_test_spec/3_1_0_unit_test_spec_nopaths.yaml +intsAllowedForFloatDoubleFormats: true +artifactId: unit-test-api +hideGenerationTimestamp: true \ No newline at end of file diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md new file mode 100644 index 00000000000..cfdad519700 --- /dev/null +++ b/docs/generators/kotlin.md @@ -0,0 +1,333 @@ +--- +title: Documentation for the kotlin generator +--- + +## METADATA + +| Property | Value | Notes | +| -------- | ----- | ----- | +| generator name | kotlin | pass this to the generate command after -g | +| generator stability | EXPERIMENTAL | | +| generator type | CLIENT | | +| generator language | Kotlin | | +| generator language version | 1.9.23 | | +| generator default templating engine | handlebars | | +| helpMsg | Generates a Kotlin client library

Features in this generator:
- v3.0.0 - [v3.1.0](#schema-feature) OpenAPI Specification support
- Very thorough documentation generated in the style of javadocs
- Input types constrained for a Schema in SomeSchema.validate
- validate method can accept arbitrary List/Map/null/int/long/double/float/String json data
- Immutable List output classes generated and returned by validate for List<?> input
- Immutable Map output classes generated and returned by validate for Map<?, ?> input
- Strictly typed list input can be instantiated in client code using generated ListBuilders
- Strictly typed map input can be instantiated in client code using generated MapBuilders
- Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:
- `new MapBuilder().requiredA("a").requiredB("b").build()`
- `new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()`
- Run time type checking and validation when
- validating schema payloads
- instantiating List output class (validation run)
- instantiating Map output class (validation run)
- Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class
- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods
- Invalid (in Kotlin) property names supported like `class`, `1var`, `hi-there` etc in
- component schema names
- schema property names (a fallback setter is written in the MapBuilder)
- Generated interfaces are largely consistent with the python code
- Openapi spec inline schemas supported at any depth in any location
- Format support for: int32, int64, float, double, date, datetime, uuid
- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string
- enum types are generated for enums of type string/integer/number/boolean/null
- String transmission of numbers supported with type: string, format: number | | + +## CONFIG OPTIONS +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|artifactDescription|artifact description in generated pom.xml| |OpenAPI Kotlin| +|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator| +|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0| +|developerEmail|developer email in generated pom.xml| |team@openapijsonschematools.org| +|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| +|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| +|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapijsonschematools.org| +|groupId|groupId in generated pom.xml| |org.openapijsonschematools| +|invokerPackage|root package for generated code| |org.openapijsonschematools.client| +|licenseName|The name of the license| |Unlicense| +|licenseUrl|The URL of the license| |http://unlicense.org| +|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| +|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git| +|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git| +|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator| +|snapshotVersion|Uses a SNAPSHOT version.|
**true**
Use a SnapShot Version
**false**
Use a Release Version
|null| +|sourceFolder|source folder for generated code| |src/main/kotlin| +|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| + +## SUPPORTED VENDOR EXTENSIONS + +| Extension name | Description | Applicable for | Default value | +| -------------- | ----------- | -------------- | ------------- | +|x-enum-varnames|A list of strings that defines the enum variable names, must be adjacent to enum|SCHEMA|[] +|x-enum-descriptions|A list of strings that defines the enum descriptions, must be adjacent to enum|SCHEMA|[] + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|FrozenList| +|boolean|Boolean| +|integer|Number (Int, Long, Float with integer values, Double with integer values)| +|null|Nothing? (null)| +|number|Number (Int, Long, Float, Double)| +|object|FrozenMap| +|string|String| + + +## LANGUAGE PRIMITIVES + + + +## RESERVED WORDS + + + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Components Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|schemas|✓|OAS3 +|responses|✓|OAS3 +|parameters|✓|OAS3 +|examples|✗|OAS3 +|requestBodies|✓|OAS3 +|headers|✓|OAS3 +|securitySchemes|✓|OAS3 +|links|✗|OAS3 +|callbacks|✗|OAS3 +|pathItems|✗|OAS3 + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Integer|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Number|✓|OAS2,OAS3 +|String|✓|OAS2,OAS3 +|Byte|✗|OAS2,OAS3 +|Binary|✗|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✗|OAS2,OAS3 +|File|✗|OAS2 +|Uuid|✓|OAS2,OAS3 +|Array|✓|OAS2,OAS3 +|Null|✓|OAS3 +|AnyType|✓|OAS2,OAS3 +|Object|✓|OAS2,OAS3 +|Enum|✓|OAS2,OAS3 + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Servers|✓|OAS3 +|Security|✓|OAS2,OAS3 +|ComponentSchemas|✓|OAS3 +|ComponentResponses|✓|OAS3 +|ComponentParameters|✓|OAS3 +|ComponentRequestBodies|✓|OAS3 +|ComponentHeaders|✓|OAS3 +|ComponentSecuritySchemes|✓|OAS3 +|ComponentLinks|✗|OAS3 +|ComponentCallbacks|✗|OAS3 +|ComponentPathItems|✗|OAS3 +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Info|✓|OAS2,OAS3 +|Servers|✓|OAS3 +|Paths|✓|OAS2,OAS3 +|Webhooks|✗|OAS3 +|Components|✓|OAS3 +|Security|✓|OAS2,OAS3 +|Tags|✗|OAS2,OAS3 +|ExternalDocs|✗|OAS2,OAS3 + +### Operation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Responses_HttpStatusCode|✓|OAS3 +|Responses_RangedResponseCodes|✓|OAS3 +|Responses_Default|✓|OAS3 +|Responses_RedirectionResponse|✓|OAS3 +|Security|✓|OAS2,OAS3 +|Servers|✓|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Name|✗|OAS2,OAS3 +|Required|✗|OAS2,OAS3 +|In_Path|✗|OAS2,OAS3 +|In_Query|✗|OAS2,OAS3 +|In_Header|✗|OAS2,OAS3 +|In_Cookie|✗|OAS3 +|Style_Matrix|✗|OAS3 +|Style_Label|✗|OAS3 +|Style_Form|✗|OAS3 +|Style_Simple|✗|OAS3 +|Style_SpaceDelimited|✗|OAS3 +|Style_PipeDelimited|✗|OAS3 +|Style_DeepObject|✗|OAS3 +|Explode|✗|OAS3 +|Schema|✗|OAS3 +|Content|✗|OAS3 + +### Schema Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|AdditionalProperties|✓|OAS2,OAS3 +|AllOf|✓|OAS2,OAS3 +|AnyOf|✓|OAS3 +|Const|✓|OAS3 +|Contains|✓|OAS3 +|Default|✓|OAS2,OAS3 +|DependentRequired|✓|OAS3 +|DependentSchemas|✓|OAS3 +|Discriminator|✗|OAS2,OAS3 +|Else|✓|OAS3 +|Enum|✓|OAS2,OAS3 +|ExclusiveMinimum|✓|OAS2,OAS3 +|ExclusiveMaximum|✓|OAS2,OAS3 +|Format|✓|OAS2,OAS3 +|If|✓|OAS3 +|Items|✓|OAS2,OAS3 +|MaxContains|✓|OAS3 +|MaxItems|✓|OAS2,OAS3 +|MaxLength|✓|OAS2,OAS3 +|MaxProperties|✓|OAS2,OAS3 +|Maximum|✓|OAS2,OAS3 +|MinContains|✓|OAS3 +|MinItems|✓|OAS2,OAS3 +|MinLength|✓|OAS2,OAS3 +|MinProperties|✓|OAS2,OAS3 +|Minimum|✓|OAS2,OAS3 +|MultipleOf|✓|OAS2,OAS3 +|Not|✓|OAS3 +|Nullable|✓|OAS3 +|OneOf|✓|OAS3 +|Pattern|✓|OAS2,OAS3 +|PatternProperties|✓|OAS3 +|PrefixItems|✓|OAS3 +|Properties|✓|OAS2,OAS3 +|PropertyNames|✓|OAS3 +|Ref|✓|OAS2,OAS3 +|Required|✓|OAS2,OAS3 +|Then|✓|OAS3 +|Type|✓|OAS2,OAS3 +|UnevaluatedItems|✓|OAS3 +|UnevaluatedProperties|✓|OAS3 +|UniqueItems|✓|OAS2,OAS3 +|Xml|✗|OAS2,OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|HTTP_Basic|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|HTTP_Bearer|✓|OAS2,OAS3 +|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✗|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/samples/client/3_0_3_unit_test/kotlin/.gitignore b/samples/client/3_0_3_unit_test/kotlin/.gitignore new file mode 100644 index 00000000000..3a4ec036d04 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/.gitignore @@ -0,0 +1,9 @@ +build/ +.gradle/ +.idea/ +target/ + +# gradle wrapper +gradlew +gradlew.bat +gradle/ \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/.openapi-generator-ignore b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator-ignore new file mode 100644 index 00000000000..d24a2da8ae5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/FILES b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/FILES new file mode 100644 index 00000000000..d1894677fa0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/FILES @@ -0,0 +1,304 @@ +.gitignore +README.md +build.gradle.kts +docs/RootServerInfo.md +docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md +docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md +docs/components/schemas/AdditionalpropertiesCanExistByItself.md +docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md +docs/components/schemas/Allof.md +docs/components/schemas/AllofCombinedWithAnyofOneof.md +docs/components/schemas/AllofSimpleTypes.md +docs/components/schemas/AllofWithBaseSchema.md +docs/components/schemas/AllofWithOneEmptySchema.md +docs/components/schemas/AllofWithTheFirstEmptySchema.md +docs/components/schemas/AllofWithTheLastEmptySchema.md +docs/components/schemas/AllofWithTwoEmptySchemas.md +docs/components/schemas/Anyof.md +docs/components/schemas/AnyofComplexTypes.md +docs/components/schemas/AnyofWithBaseSchema.md +docs/components/schemas/AnyofWithOneEmptySchema.md +docs/components/schemas/ArrayTypeMatchesArrays.md +docs/components/schemas/BooleanTypeMatchesBooleans.md +docs/components/schemas/ByInt.md +docs/components/schemas/ByNumber.md +docs/components/schemas/BySmallNumber.md +docs/components/schemas/DateTimeFormat.md +docs/components/schemas/EmailFormat.md +docs/components/schemas/EnumWith0DoesNotMatchFalse.md +docs/components/schemas/EnumWith1DoesNotMatchTrue.md +docs/components/schemas/EnumWithEscapedCharacters.md +docs/components/schemas/EnumWithFalseDoesNotMatch0.md +docs/components/schemas/EnumWithTrueDoesNotMatch1.md +docs/components/schemas/EnumsInProperties.md +docs/components/schemas/ForbiddenProperty.md +docs/components/schemas/HostnameFormat.md +docs/components/schemas/IntegerTypeMatchesIntegers.md +docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md +docs/components/schemas/InvalidStringValueForDefault.md +docs/components/schemas/Ipv4Format.md +docs/components/schemas/Ipv6Format.md +docs/components/schemas/JsonPointerFormat.md +docs/components/schemas/MaximumValidation.md +docs/components/schemas/MaximumValidationWithUnsignedInteger.md +docs/components/schemas/MaxitemsValidation.md +docs/components/schemas/MaxlengthValidation.md +docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md +docs/components/schemas/MaxpropertiesValidation.md +docs/components/schemas/MinimumValidation.md +docs/components/schemas/MinimumValidationWithSignedInteger.md +docs/components/schemas/MinitemsValidation.md +docs/components/schemas/MinlengthValidation.md +docs/components/schemas/MinpropertiesValidation.md +docs/components/schemas/NestedAllofToCheckValidationSemantics.md +docs/components/schemas/NestedAnyofToCheckValidationSemantics.md +docs/components/schemas/NestedItems.md +docs/components/schemas/NestedOneofToCheckValidationSemantics.md +docs/components/schemas/Not.md +docs/components/schemas/NotMoreComplexSchema.md +docs/components/schemas/NulCharactersInStrings.md +docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md +docs/components/schemas/NumberTypeMatchesNumbers.md +docs/components/schemas/ObjectPropertiesValidation.md +docs/components/schemas/ObjectTypeMatchesObjects.md +docs/components/schemas/Oneof.md +docs/components/schemas/OneofComplexTypes.md +docs/components/schemas/OneofWithBaseSchema.md +docs/components/schemas/OneofWithEmptySchema.md +docs/components/schemas/OneofWithRequired.md +docs/components/schemas/PatternIsNotAnchored.md +docs/components/schemas/PatternValidation.md +docs/components/schemas/PropertiesWithEscapedCharacters.md +docs/components/schemas/PropertyNamedRefThatIsNotAReference.md +docs/components/schemas/RefInAdditionalproperties.md +docs/components/schemas/RefInAllof.md +docs/components/schemas/RefInAnyof.md +docs/components/schemas/RefInItems.md +docs/components/schemas/RefInNot.md +docs/components/schemas/RefInOneof.md +docs/components/schemas/RefInProperty.md +docs/components/schemas/RequiredDefaultValidation.md +docs/components/schemas/RequiredValidation.md +docs/components/schemas/RequiredWithEmptyArray.md +docs/components/schemas/RequiredWithEscapedCharacters.md +docs/components/schemas/SimpleEnumValidation.md +docs/components/schemas/StringTypeMatchesStrings.md +docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md +docs/components/schemas/UniqueitemsFalseValidation.md +docs/components/schemas/UniqueitemsValidation.md +docs/components/schemas/UriFormat.md +docs/components/schemas/UriReferenceFormat.md +docs/components/schemas/UriTemplateFormat.md +docs/servers/RootServer0.md +settings.gradle.kts +src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt +src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt +src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt +src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt diff --git a/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/VERSION b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/VERSION new file mode 100644 index 00000000000..717311e32e3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/.openapi-generator/VERSION @@ -0,0 +1 @@ +unset \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/README.md b/samples/client/3_0_3_unit_test/kotlin/README.md new file mode 100644 index 00000000000..7420e97162c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/README.md @@ -0,0 +1,224 @@ +# unit-test-api +sample spec for testing openapi functionality, built from json schema tests for draft6 + +This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: + +- OpenAPI document version: 0.0.1 +- Kotlin Package version: 0.0.1 +- OpenAPI JSON Schema Generator, Generator: KotlinClientGenerator + +## Requirements + +1. Kotlin 1.9.23 +2. Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +gradle wrapper +gradlew clean build +``` + +### Gradle users + +Add this dependency to your project's build file: + +``` +repositories { + mavenCentral() // Needed if the 'unit-test-api' jar has been published to maven centra + mavenLocal() // Needed if the 'unit-test-api' jar has been published to the local maven repo +} + +dependencies { + implementation "org.openapijsonschematools:unit-test-api:0.0.1" +} +``` + +## Usage Notes +### Validation, Immutability, and Data Type +This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that +- valid data cannot be mutated and become invalid to a set of schemas + - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable + +Here is the mapping from json schema types to Kotlin types: + +| Json Schema Type | Kotlin Base Class | +| ---------------- | --------------- | +| object | FrozenMap (Map) | +| array | FrozenList (List) | +| string | String | +| number | Number (Int, Long, Float, Double) | +| integer | Int, Long, Float, Double (with values equal to integers) | +| boolean | Boolean | +| null | Nothing? (null) | +| AnyType (unset) | Any? | + +### Storage of Json Schema Definition in Kotlin JsonSchema Classes +In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if +type is unset. I have chosen to separate the storage of +- json schema definition info +- output classes for validated Map (json schema type object) payloads +- output classes for validated List (json schema type array) payloads + +
+ Reason + +This json schema data is stored in each class that is written for a schema, in a component or +other openapi document location. This class is only responsible for storing schema info. +Output classes like those that store map payloads are written separately and are +returned by the JsonSchema.validate method when that method is passed in Map input. +This prevents payload property access methods from +colliding with json schema definition. +
+ +### Json Schema Type Object +Most component schemas (models) are probably of type object. Which is a map data structure. +Json schema allows string keys in this map, which means schema properties can have key names that are +invalid Kotlin variable names. Names like: +- "hi-there" +- "1variable" +- "@now" +- " " +- "from" + +To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. +This means that one can use normal Map methods on instances of these classes. + +
+ Other Details + +- getters are written for validly named required and optional properties +- null is only allowed in as a value if type: "null" was included or nullable: true was set + - because null is an allowed property value, it is not used to represent an unset property state +- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown +
+ +### Json Schema Type + Format, Validated Data Storage +N schemas can be validated on the same payload. +To allow multiple schemas to validate, the data must be stored using one base class whether or not +a json schema format constraint exists in the schema. + +In json schema, type: number with no format validates both integers and floats, +so int and float values are stored for type number. + +
+ String + Date Example + +For example the string payload '2023-12-20' is validates to both of these schemas: +1. string only +``` +- type: string +``` +2. string and date format +``` +- type: string + format: date +``` +Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data +is stored as a string. +
+ +## Getting Started + +Please follow the [installation procedure](#installation) and then use the JsonSchema classes in +org.openapijsonschematools.client.components.schemas to validate input payloads and instances of validated Map and List +output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have +allowed input and output types. + +## Servers +| server_index | Class | Description | +| ------------ | ----- | ----------- | +| 0 | [RootServer0](docs/servers/RootServer0.md) | | + +## Component Schemas +| Class | Description | +| ----- | ----------- | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1](docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md#additionalpropertiesallowsaschemawhichshouldvalidate1) | | +| [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md#additionalpropertiesareallowedbydefault1) | | +| [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](docs/components/schemas/AdditionalpropertiesCanExistByItself.md#additionalpropertiescanexistbyitself1) | | +| [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1](docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md#additionalpropertiesshouldnotlookinapplicators1) | | +| [Allof.Allof1](docs/components/schemas/Allof.md#allof1) | | +| [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](docs/components/schemas/AllofCombinedWithAnyofOneof.md#allofcombinedwithanyofoneof1) | | +| [AllofSimpleTypes.AllofSimpleTypes1](docs/components/schemas/AllofSimpleTypes.md#allofsimpletypes1) | | +| [AllofWithBaseSchema.AllofWithBaseSchema1](docs/components/schemas/AllofWithBaseSchema.md#allofwithbaseschema1) | | +| [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](docs/components/schemas/AllofWithOneEmptySchema.md#allofwithoneemptyschema1) | | +| [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](docs/components/schemas/AllofWithTheFirstEmptySchema.md#allofwiththefirstemptyschema1) | | +| [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](docs/components/schemas/AllofWithTheLastEmptySchema.md#allofwiththelastemptyschema1) | | +| [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](docs/components/schemas/AllofWithTwoEmptySchemas.md#allofwithtwoemptyschemas1) | | +| [Anyof.Anyof1](docs/components/schemas/Anyof.md#anyof1) | | +| [AnyofComplexTypes.AnyofComplexTypes1](docs/components/schemas/AnyofComplexTypes.md#anyofcomplextypes1) | | +| [AnyofWithBaseSchema.AnyofWithBaseSchema1](docs/components/schemas/AnyofWithBaseSchema.md#anyofwithbaseschema1) | | +| [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](docs/components/schemas/AnyofWithOneEmptySchema.md#anyofwithoneemptyschema1) | | +| [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](docs/components/schemas/ArrayTypeMatchesArrays.md#arraytypematchesarrays1) | | +| [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](docs/components/schemas/BooleanTypeMatchesBooleans.md#booleantypematchesbooleans1) | | +| [ByInt.ByInt1](docs/components/schemas/ByInt.md#byint1) | | +| [ByNumber.ByNumber1](docs/components/schemas/ByNumber.md#bynumber1) | | +| [BySmallNumber.BySmallNumber1](docs/components/schemas/BySmallNumber.md#bysmallnumber1) | | +| [DateTimeFormat.DateTimeFormat1](docs/components/schemas/DateTimeFormat.md#datetimeformat1) | | +| [EmailFormat.EmailFormat1](docs/components/schemas/EmailFormat.md#emailformat1) | | +| [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](docs/components/schemas/EnumWith0DoesNotMatchFalse.md#enumwith0doesnotmatchfalse1) | | +| [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](docs/components/schemas/EnumWith1DoesNotMatchTrue.md#enumwith1doesnotmatchtrue1) | | +| [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](docs/components/schemas/EnumWithEscapedCharacters.md#enumwithescapedcharacters1) | | +| [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](docs/components/schemas/EnumWithFalseDoesNotMatch0.md#enumwithfalsedoesnotmatch01) | | +| [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](docs/components/schemas/EnumWithTrueDoesNotMatch1.md#enumwithtruedoesnotmatch11) | | +| [EnumsInProperties.EnumsInProperties1](docs/components/schemas/EnumsInProperties.md#enumsinproperties1) | | +| [ForbiddenProperty.ForbiddenProperty1](docs/components/schemas/ForbiddenProperty.md#forbiddenproperty1) | | +| [HostnameFormat.HostnameFormat1](docs/components/schemas/HostnameFormat.md#hostnameformat1) | | +| [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](docs/components/schemas/IntegerTypeMatchesIntegers.md#integertypematchesintegers1) | | +| [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1](docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1) | | +| [InvalidStringValueForDefault.InvalidStringValueForDefault1](docs/components/schemas/InvalidStringValueForDefault.md#invalidstringvaluefordefault1) | | +| [Ipv4Format.Ipv4Format1](docs/components/schemas/Ipv4Format.md#ipv4format1) | | +| [Ipv6Format.Ipv6Format1](docs/components/schemas/Ipv6Format.md#ipv6format1) | | +| [JsonPointerFormat.JsonPointerFormat1](docs/components/schemas/JsonPointerFormat.md#jsonpointerformat1) | | +| [MaximumValidation.MaximumValidation1](docs/components/schemas/MaximumValidation.md#maximumvalidation1) | | +| [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](docs/components/schemas/MaximumValidationWithUnsignedInteger.md#maximumvalidationwithunsignedinteger1) | | +| [MaxitemsValidation.MaxitemsValidation1](docs/components/schemas/MaxitemsValidation.md#maxitemsvalidation1) | | +| [MaxlengthValidation.MaxlengthValidation1](docs/components/schemas/MaxlengthValidation.md#maxlengthvalidation1) | | +| [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md#maxproperties0meanstheobjectisempty1) | | +| [MaxpropertiesValidation.MaxpropertiesValidation1](docs/components/schemas/MaxpropertiesValidation.md#maxpropertiesvalidation1) | | +| [MinimumValidation.MinimumValidation1](docs/components/schemas/MinimumValidation.md#minimumvalidation1) | | +| [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](docs/components/schemas/MinimumValidationWithSignedInteger.md#minimumvalidationwithsignedinteger1) | | +| [MinitemsValidation.MinitemsValidation1](docs/components/schemas/MinitemsValidation.md#minitemsvalidation1) | | +| [MinlengthValidation.MinlengthValidation1](docs/components/schemas/MinlengthValidation.md#minlengthvalidation1) | | +| [MinpropertiesValidation.MinpropertiesValidation1](docs/components/schemas/MinpropertiesValidation.md#minpropertiesvalidation1) | | +| [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](docs/components/schemas/NestedAllofToCheckValidationSemantics.md#nestedalloftocheckvalidationsemantics1) | | +| [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](docs/components/schemas/NestedAnyofToCheckValidationSemantics.md#nestedanyoftocheckvalidationsemantics1) | | +| [NestedItems.NestedItems1](docs/components/schemas/NestedItems.md#nesteditems1) | | +| [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](docs/components/schemas/NestedOneofToCheckValidationSemantics.md#nestedoneoftocheckvalidationsemantics1) | | +| [Not.Not1](docs/components/schemas/Not.md#not1) | | +| [NotMoreComplexSchema.NotMoreComplexSchema1](docs/components/schemas/NotMoreComplexSchema.md#notmorecomplexschema1) | | +| [NulCharactersInStrings.NulCharactersInStrings1](docs/components/schemas/NulCharactersInStrings.md#nulcharactersinstrings1) | | +| [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md#nulltypematchesonlythenullobject1) | | +| [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](docs/components/schemas/NumberTypeMatchesNumbers.md#numbertypematchesnumbers1) | | +| [ObjectPropertiesValidation.ObjectPropertiesValidation1](docs/components/schemas/ObjectPropertiesValidation.md#objectpropertiesvalidation1) | | +| [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](docs/components/schemas/ObjectTypeMatchesObjects.md#objecttypematchesobjects1) | | +| [Oneof.Oneof1](docs/components/schemas/Oneof.md#oneof1) | | +| [OneofComplexTypes.OneofComplexTypes1](docs/components/schemas/OneofComplexTypes.md#oneofcomplextypes1) | | +| [OneofWithBaseSchema.OneofWithBaseSchema1](docs/components/schemas/OneofWithBaseSchema.md#oneofwithbaseschema1) | | +| [OneofWithEmptySchema.OneofWithEmptySchema1](docs/components/schemas/OneofWithEmptySchema.md#oneofwithemptyschema1) | | +| [OneofWithRequired.OneofWithRequired1](docs/components/schemas/OneofWithRequired.md#oneofwithrequired1) | | +| [PatternIsNotAnchored.PatternIsNotAnchored1](docs/components/schemas/PatternIsNotAnchored.md#patternisnotanchored1) | | +| [PatternValidation.PatternValidation1](docs/components/schemas/PatternValidation.md#patternvalidation1) | | +| [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](docs/components/schemas/PropertiesWithEscapedCharacters.md#propertieswithescapedcharacters1) | | +| [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](docs/components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | | +| [RefInAdditionalproperties.RefInAdditionalproperties1](docs/components/schemas/RefInAdditionalproperties.md#refinadditionalproperties1) | | +| [RefInAllof.RefInAllof1](docs/components/schemas/RefInAllof.md#refinallof1) | | +| [RefInAnyof.RefInAnyof1](docs/components/schemas/RefInAnyof.md#refinanyof1) | | +| [RefInItems.RefInItems1](docs/components/schemas/RefInItems.md#refinitems1) | | +| [RefInNot.RefInNot1](docs/components/schemas/RefInNot.md#refinnot1) | | +| [RefInOneof.RefInOneof1](docs/components/schemas/RefInOneof.md#refinoneof1) | | +| [RefInProperty.RefInProperty1](docs/components/schemas/RefInProperty.md#refinproperty1) | | +| [RequiredDefaultValidation.RequiredDefaultValidation1](docs/components/schemas/RequiredDefaultValidation.md#requireddefaultvalidation1) | | +| [RequiredValidation.RequiredValidation1](docs/components/schemas/RequiredValidation.md#requiredvalidation1) | | +| [RequiredWithEmptyArray.RequiredWithEmptyArray1](docs/components/schemas/RequiredWithEmptyArray.md#requiredwithemptyarray1) | | +| [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](docs/components/schemas/RequiredWithEscapedCharacters.md#requiredwithescapedcharacters1) | | +| [SimpleEnumValidation.SimpleEnumValidation1](docs/components/schemas/SimpleEnumValidation.md#simpleenumvalidation1) | | +| [StringTypeMatchesStrings.StringTypeMatchesStrings1](docs/components/schemas/StringTypeMatchesStrings.md#stringtypematchesstrings1) | | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1](docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1) | | +| [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](docs/components/schemas/UniqueitemsFalseValidation.md#uniqueitemsfalsevalidation1) | | +| [UniqueitemsValidation.UniqueitemsValidation1](docs/components/schemas/UniqueitemsValidation.md#uniqueitemsvalidation1) | | +| [UriFormat.UriFormat1](docs/components/schemas/UriFormat.md#uriformat1) | | +| [UriReferenceFormat.UriReferenceFormat1](docs/components/schemas/UriReferenceFormat.md#urireferenceformat1) | | +| [UriTemplateFormat.UriTemplateFormat1](docs/components/schemas/UriTemplateFormat.md#uritemplateformat1) | | diff --git a/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts new file mode 100644 index 00000000000..882b3b35624 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + kotlin("jvm") version "1.9.23" +} + +repositories { + mavenLocal() + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } +} + +dependencies { + implementation(kotlin("reflect")) + testImplementation(kotlin("test")) + implementation("org.checkerframework:checker-qual:3.42.0") + implementation("com.google.code.gson:gson:2.10.1") + testImplementation("junit:junit:4.13.2") +} + +group = "org.openapijsonschematools" +version = "0.0.1" +description = "OpenAPI Kotlin" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + +tasks.wrapper { + gradleVersion = "8.1.1" +} + +tasks.compileKotlin { + kotlinDaemonJvmArguments.add("-Xmx1g") +} + +tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/RootServerInfo.md b/samples/client/3_0_3_unit_test/kotlin/docs/RootServerInfo.md new file mode 100644 index 00000000000..46c3ca818e6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/RootServerInfo.md @@ -0,0 +1,59 @@ +# RootServerInfo +RootServerInfo.java + +public class RootServerInfo + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RootServerInfo.RootServerInfo1](#rootserverinfo1)
class that stores a server index | +| static class | [RootServerInfo.RootServerInfoBuilder](#rootserverinfobuilder)
class that stores a server index | +| enum | [RootServerInfo.ServerIndex](#serverindex)
class that stores a server index | + +## RootServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfo1(@Nullable [RootServer0](servers/RootServer0.md) server0)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServer0](servers/RootServer0.md) | server0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + +## RootServerInfoBuilder + +a builder for [RootServerInfo1](#rootserverinfo1) + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfoBuilder()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer0([RootServer0](servers/RootServer0.md) server0)
sets the server | +| [RootServerInfo1](#rootserverinfo1) | build() | + +## ServerIndex +enum ServerIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SERVER_0
server 0 | diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md new file mode 100644 index 00000000000..4cb6a86186d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md @@ -0,0 +1,446 @@ +# AdditionalpropertiesAllowsASchemaWhichShouldValidate +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesAllowsASchemaWhichShouldValidate.java +class AdditionalpropertiesAllowsASchemaWhichShouldValidate
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed](#additionalpropertiesallowsaschemawhichshouldvalidate1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap](#additionalpropertiesallowsaschemawhichshouldvalidate1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1](#additionalpropertiesallowsaschemawhichshouldvalidate1)
schema class | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.Bar](#bar)
schema class | +| sealed interface | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.Foo](#foo)
schema class | +| sealed interface | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed +sealed interface AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed
+permits
+[AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap](#additionalpropertiesallowsaschemawhichshouldvalidate1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap +data class AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap
+implements [AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed](#additionalpropertiesallowsaschemawhichshouldvalidate1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap([AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidate1 +class AdditionalpropertiesAllowsASchemaWhichShouldValidate1
+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.AdditionalpropertiesAllowsASchemaWhichShouldValidate; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validatedPayload = + AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.validate( + new AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) | validate(arg: [Map<?, ?>](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap](#additionalpropertiesallowsaschemawhichshouldvalidate1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed](#additionalpropertiesallowsaschemawhichshouldvalidate1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder +class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: String) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Int) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Float) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Long) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Double) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: List) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | foo(value: Map) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: String) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Int) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Float) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Long) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Double) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: List) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | bar(value: Map) | +| [AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesAllowsASchemaWhichShouldValidateMap +class AdditionalpropertiesAllowsASchemaWhichShouldValidateMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesAllowsASchemaWhichShouldValidateMap](#additionalpropertiesallowsaschemawhichshouldvalidatemap) | of([Map](#additionalpropertiesallowsaschemawhichshouldvalidatemapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | bar()
[optional] | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md new file mode 100644 index 00000000000..c3785564640 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md @@ -0,0 +1,496 @@ +# AdditionalpropertiesAreAllowedByDefault +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesAreAllowedByDefault.java +class AdditionalpropertiesAreAllowedByDefault
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](#additionalpropertiesareallowedbydefault1)
schema class | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Bar](#bar)
schema class | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Foo](#foo)
schema class | + +## AdditionalpropertiesAreAllowedByDefault1Boxed +sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed
+permits
+[AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid), +[AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean), +[AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber), +[AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring), +[AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist), +[AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesAreAllowedByDefault1BoxedVoid +data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedBoolean +data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedNumber +data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedString +data class AdditionalpropertiesAreAllowedByDefault1BoxedString
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedList +data class AdditionalpropertiesAreAllowedByDefault1BoxedList
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedMap +data class AdditionalpropertiesAreAllowedByDefault1BoxedMap
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedMap([AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1 +class AdditionalpropertiesAreAllowedByDefault1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | validate(arg: [Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesAreAllowedByDefaultMapBuilder +class AdditionalpropertiesAreAllowedByDefaultMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefaultMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Map) | + +## AdditionalpropertiesAreAllowedByDefaultMap +class AdditionalpropertiesAreAllowedByDefaultMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | of([Map](#additionalpropertiesareallowedbydefaultmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md new file mode 100644 index 00000000000..fdc764ec2a1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md @@ -0,0 +1,159 @@ +# AdditionalpropertiesCanExistByItself +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesCanExistByItself.java +class AdditionalpropertiesCanExistByItself
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](#additionalpropertiescanexistbyitself1)
schema class | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesCanExistByItself1Boxed +sealed interface AdditionalpropertiesCanExistByItself1Boxed
+permits
+[AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesCanExistByItself1BoxedMap +data class AdditionalpropertiesCanExistByItself1BoxedMap
+implements [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItself1BoxedMap([AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesCanExistByItself1 +class AdditionalpropertiesCanExistByItself1
+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.AdditionalpropertiesCanExistByItself; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap validatedPayload = + AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.validate( + new AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | validate(arg: [Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesCanExistByItselfMapBuilder +class AdditionalpropertiesCanExistByItselfMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItselfMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesCanExistByItselfMap +class AdditionalpropertiesCanExistByItselfMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | of([Map](#additionalpropertiescanexistbyitselfmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md new file mode 100644 index 00000000000..9e7412315c2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md @@ -0,0 +1,578 @@ +# AdditionalpropertiesShouldNotLookInApplicators +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesShouldNotLookInApplicators.java +class AdditionalpropertiesShouldNotLookInApplicators
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid](#additionalpropertiesshouldnotlookinapplicators1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean](#additionalpropertiesshouldnotlookinapplicators1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber](#additionalpropertiesshouldnotlookinapplicators1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedString](#additionalpropertiesshouldnotlookinapplicators1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedList](#additionalpropertiesshouldnotlookinapplicators1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1BoxedMap](#additionalpropertiesshouldnotlookinapplicators1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1](#additionalpropertiesshouldnotlookinapplicators1)
schema class | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesShouldNotLookInApplicators.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Schema0](#schema0)
schema class | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.Foo](#foo)
schema class | +| sealed interface | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesShouldNotLookInApplicators.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesShouldNotLookInApplicators1Boxed +sealed interface AdditionalpropertiesShouldNotLookInApplicators1Boxed
+permits
+[AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid](#additionalpropertiesshouldnotlookinapplicators1boxedvoid), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean](#additionalpropertiesshouldnotlookinapplicators1boxedboolean), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber](#additionalpropertiesshouldnotlookinapplicators1boxednumber), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedString](#additionalpropertiesshouldnotlookinapplicators1boxedstring), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedList](#additionalpropertiesshouldnotlookinapplicators1boxedlist), +[AdditionalpropertiesShouldNotLookInApplicators1BoxedMap](#additionalpropertiesshouldnotlookinapplicators1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedString +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedString
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedList +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedList
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1BoxedMap +data class AdditionalpropertiesShouldNotLookInApplicators1BoxedMap
+implements [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicators1BoxedMap([AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesShouldNotLookInApplicators1 +class AdditionalpropertiesShouldNotLookInApplicators1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) | validate(arg: [Map<?, ?>](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedString](#additionalpropertiesshouldnotlookinapplicators1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid](#additionalpropertiesshouldnotlookinapplicators1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber](#additionalpropertiesshouldnotlookinapplicators1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean](#additionalpropertiesshouldnotlookinapplicators1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedMap](#additionalpropertiesshouldnotlookinapplicators1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1BoxedList](#additionalpropertiesshouldnotlookinapplicators1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesShouldNotLookInApplicators1Boxed](#additionalpropertiesshouldnotlookinapplicators1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder +class AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesShouldNotLookInApplicatorsMap +class AdditionalpropertiesShouldNotLookInApplicatorsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesShouldNotLookInApplicatorsMap](#additionalpropertiesshouldnotlookinapplicatorsmap) | of([Map](#additionalpropertiesshouldnotlookinapplicatorsmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Map) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Map) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Allof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Allof.md new file mode 100644 index 00000000000..5a211961ac4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Allof.md @@ -0,0 +1,674 @@ +# Allof +org.openapijsonschematools.client.components.schemas.Allof.java +class Allof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [Allof.Allof1Boxed](#allof1boxed)
sealed interface for validated payloads | +| record | [Allof.Allof1BoxedVoid](#allof1boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Allof1BoxedBoolean](#allof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Allof1BoxedNumber](#allof1boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Allof1BoxedString](#allof1boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Allof1BoxedList](#allof1boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Allof1BoxedMap](#allof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Allof1](#allof1)
schema class | +| sealed interface | [Allof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Allof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Schema1](#schema1)
schema class | +| static class | [Allof.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [Allof.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [Allof.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [Allof.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [Allof.Foo](#foo)
schema class | +| sealed interface | [Allof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Allof.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Schema0](#schema0)
schema class | +| static class | [Allof.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [Allof.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [Allof.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [Allof.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [Allof.Bar](#bar)
schema class | + +## Allof1Boxed +sealed interface Allof1Boxed
+permits
+[Allof1BoxedVoid](#allof1boxedvoid), +[Allof1BoxedBoolean](#allof1boxedboolean), +[Allof1BoxedNumber](#allof1boxednumber), +[Allof1BoxedString](#allof1boxedstring), +[Allof1BoxedList](#allof1boxedlist), +[Allof1BoxedMap](#allof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Allof1BoxedVoid +data class Allof1BoxedVoid
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedBoolean +data class Allof1BoxedBoolean
+implements [Allof1Boxed](#allof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedNumber +data class Allof1BoxedNumber
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedString +data class Allof1BoxedString
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedList +data class Allof1BoxedList
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedMap +data class Allof1BoxedMap
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1 +class Allof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Allof1BoxedString](#allof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Allof1BoxedVoid](#allof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Allof1BoxedNumber](#allof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Allof1BoxedBoolean](#allof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Allof1BoxedMap](#allof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Allof1BoxedList](#allof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Allof1Boxed](#allof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md new file mode 100644 index 00000000000..be071761cb0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md @@ -0,0 +1,636 @@ +# AllofCombinedWithAnyofOneof +org.openapijsonschematools.client.components.schemas.AllofCombinedWithAnyofOneof.java +class AllofCombinedWithAnyofOneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](#allofcombinedwithanyofoneof1)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema0](#schema0)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedBoolean](#schema01boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema01](#schema01)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema02Boxed](#schema02boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedVoid](#schema02boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedBoolean](#schema02boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedNumber](#schema02boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedString](#schema02boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedList](#schema02boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedMap](#schema02boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema02](#schema02)
schema class | + +## AllofCombinedWithAnyofOneof1Boxed +sealed interface AllofCombinedWithAnyofOneof1Boxed
+permits
+[AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid), +[AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean), +[AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber), +[AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring), +[AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist), +[AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofCombinedWithAnyofOneof1BoxedVoid +data class AllofCombinedWithAnyofOneof1BoxedVoid
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedBoolean +data class AllofCombinedWithAnyofOneof1BoxedBoolean
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedNumber +data class AllofCombinedWithAnyofOneof1BoxedNumber
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedString +data class AllofCombinedWithAnyofOneof1BoxedString
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedList +data class AllofCombinedWithAnyofOneof1BoxedList
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedMap +data class AllofCombinedWithAnyofOneof1BoxedMap
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1 +class AllofCombinedWithAnyofOneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema02::class.java](#schema02)
;)
| +| List> | anyOf = listOf(
    [Schema01::class.java](#schema01)
)
| +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid), +[Schema01BoxedBoolean](#schema01boxedboolean), +[Schema01BoxedNumber](#schema01boxednumber), +[Schema01BoxedString](#schema01boxedstring), +[Schema01BoxedList](#schema01boxedlist), +[Schema01BoxedMap](#schema01boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedBoolean +data class Schema01BoxedBoolean
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedNumber +data class Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedString +data class Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedList +data class Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedMap +data class Schema01BoxedMap
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema01BoxedVoid](#schema01boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema01BoxedBoolean](#schema01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema02Boxed +sealed interface Schema02Boxed
+permits
+[Schema02BoxedVoid](#schema02boxedvoid), +[Schema02BoxedBoolean](#schema02boxedboolean), +[Schema02BoxedNumber](#schema02boxednumber), +[Schema02BoxedString](#schema02boxedstring), +[Schema02BoxedList](#schema02boxedlist), +[Schema02BoxedMap](#schema02boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema02BoxedVoid +data class Schema02BoxedVoid
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedBoolean +data class Schema02BoxedBoolean
+implements [Schema02Boxed](#schema02boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedNumber +data class Schema02BoxedNumber
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedString +data class Schema02BoxedString
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedList +data class Schema02BoxedList
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedMap +data class Schema02BoxedMap
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02 +class Schema02
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema02BoxedString](#schema02boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema02BoxedVoid](#schema02boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema02BoxedNumber](#schema02boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema02BoxedBoolean](#schema02boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema02BoxedMap](#schema02boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema02BoxedList](#schema02boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema02Boxed](#schema02boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md new file mode 100644 index 00000000000..3797e536800 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md @@ -0,0 +1,479 @@ +# AllofSimpleTypes +org.openapijsonschematools.client.components.schemas.AllofSimpleTypes.java +class AllofSimpleTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofSimpleTypes.AllofSimpleTypes1Boxed](#allofsimpletypes1boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.AllofSimpleTypes1](#allofsimpletypes1)
schema class | +| sealed interface | [AllofSimpleTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema1](#schema1)
schema class | +| sealed interface | [AllofSimpleTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema0](#schema0)
schema class | + +## AllofSimpleTypes1Boxed +sealed interface AllofSimpleTypes1Boxed
+permits
+[AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid), +[AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean), +[AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber), +[AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring), +[AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist), +[AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofSimpleTypes1BoxedVoid +data class AllofSimpleTypes1BoxedVoid
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedBoolean +data class AllofSimpleTypes1BoxedBoolean
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedNumber +data class AllofSimpleTypes1BoxedNumber
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedString +data class AllofSimpleTypes1BoxedString
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedList +data class AllofSimpleTypes1BoxedList
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedMap +data class AllofSimpleTypes1BoxedMap
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1 +class AllofSimpleTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 30 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md new file mode 100644 index 00000000000..2f94b4b3b6a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md @@ -0,0 +1,770 @@ +# AllofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AllofWithBaseSchema.java +class AllofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AllofWithBaseSchema.AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchema1](#allofwithbaseschema1)
schema class | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMapBuilder](#allofwithbaseschemamapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMap](#allofwithbaseschemamap)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithBaseSchema.Bar](#bar)
schema class | +| sealed interface | [AllofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema1](#schema1)
schema class | +| static class | [AllofWithBaseSchema.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BazBoxed](#bazboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BazBoxedVoid](#bazboxedvoid)
boxed class to store validated null payloads | +| static class | [AllofWithBaseSchema.Baz](#baz)
schema class | +| sealed interface | [AllofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema0](#schema0)
schema class | +| static class | [AllofWithBaseSchema.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [AllofWithBaseSchema.Foo](#foo)
schema class | + +## AllofWithBaseSchema1Boxed +sealed interface AllofWithBaseSchema1Boxed
+permits
+[AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid), +[AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean), +[AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber), +[AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring), +[AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist), +[AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithBaseSchema1BoxedVoid +data class AllofWithBaseSchema1BoxedVoid
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedBoolean +data class AllofWithBaseSchema1BoxedBoolean
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedNumber +data class AllofWithBaseSchema1BoxedNumber
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedString +data class AllofWithBaseSchema1BoxedString
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedList +data class AllofWithBaseSchema1BoxedList
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedMap +data class AllofWithBaseSchema1BoxedMap
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedMap([AllofWithBaseSchemaMap](#allofwithbaseschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1 +class AllofWithBaseSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | validate(arg: [Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) | validateAndBox([Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AllofWithBaseSchemaMap0Builder +class AllofWithBaseSchemaMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Nothing?) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Boolean) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: String) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Double) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: List) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Map) | + +## AllofWithBaseSchemaMapBuilder +class AllofWithBaseSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Double) | + +## AllofWithBaseSchemaMap +class AllofWithBaseSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | of([Map](#allofwithbaseschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "baz" to [Baz::class.java](#baz))
)
| +| Set | required = setOf(
    "baz"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | baz(value: Nothing?) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | baz()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BazBoxed +sealed interface BazBoxed
+permits
+[BazBoxedVoid](#bazboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## BazBoxedVoid +data class BazBoxedVoid
+implements [BazBoxed](#bazboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BazBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Baz +class Baz
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | foo(value: String) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md new file mode 100644 index 00000000000..3a4586b5661 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md @@ -0,0 +1,302 @@ +# AllofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithOneEmptySchema.java +class AllofWithOneEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](#allofwithoneemptyschema1)
schema class | +| sealed interface | [AllofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithOneEmptySchema1Boxed +sealed interface AllofWithOneEmptySchema1Boxed
+permits
+[AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid), +[AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean), +[AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber), +[AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring), +[AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist), +[AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithOneEmptySchema1BoxedVoid +data class AllofWithOneEmptySchema1BoxedVoid
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedBoolean +data class AllofWithOneEmptySchema1BoxedBoolean
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedNumber +data class AllofWithOneEmptySchema1BoxedNumber
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedString +data class AllofWithOneEmptySchema1BoxedString
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedList +data class AllofWithOneEmptySchema1BoxedList
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedMap +data class AllofWithOneEmptySchema1BoxedMap
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1 +class AllofWithOneEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md new file mode 100644 index 00000000000..9e14a960664 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheFirstEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheFirstEmptySchema.java +class AllofWithTheFirstEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](#allofwiththefirstemptyschema1)
schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithTheFirstEmptySchema1Boxed +sealed interface AllofWithTheFirstEmptySchema1Boxed
+permits
+[AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid), +[AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean), +[AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber), +[AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring), +[AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist), +[AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheFirstEmptySchema1BoxedVoid +data class AllofWithTheFirstEmptySchema1BoxedVoid
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedBoolean +data class AllofWithTheFirstEmptySchema1BoxedBoolean
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedNumber +data class AllofWithTheFirstEmptySchema1BoxedNumber
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedString +data class AllofWithTheFirstEmptySchema1BoxedString
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedList +data class AllofWithTheFirstEmptySchema1BoxedList
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedMap +data class AllofWithTheFirstEmptySchema1BoxedMap
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1 +class AllofWithTheFirstEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedNumber](#schema1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md new file mode 100644 index 00000000000..b67c14c1c5a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheLastEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheLastEmptySchema.java +class AllofWithTheLastEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](#allofwiththelastemptyschema1)
schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithTheLastEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithTheLastEmptySchema1Boxed +sealed interface AllofWithTheLastEmptySchema1Boxed
+permits
+[AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid), +[AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean), +[AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber), +[AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring), +[AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist), +[AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheLastEmptySchema1BoxedVoid +data class AllofWithTheLastEmptySchema1BoxedVoid
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedBoolean +data class AllofWithTheLastEmptySchema1BoxedBoolean
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedNumber +data class AllofWithTheLastEmptySchema1BoxedNumber
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedString +data class AllofWithTheLastEmptySchema1BoxedString
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedList +data class AllofWithTheLastEmptySchema1BoxedList
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedMap +data class AllofWithTheLastEmptySchema1BoxedMap
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1 +class AllofWithTheLastEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md new file mode 100644 index 00000000000..18791b95b8d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md @@ -0,0 +1,435 @@ +# AllofWithTwoEmptySchemas +org.openapijsonschematools.client.components.schemas.AllofWithTwoEmptySchemas.java +class AllofWithTwoEmptySchemas
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](#allofwithtwoemptyschemas1)
schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema0](#schema0)
schema class | + +## AllofWithTwoEmptySchemas1Boxed +sealed interface AllofWithTwoEmptySchemas1Boxed
+permits
+[AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid), +[AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean), +[AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber), +[AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring), +[AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist), +[AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTwoEmptySchemas1BoxedVoid +data class AllofWithTwoEmptySchemas1BoxedVoid
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedBoolean +data class AllofWithTwoEmptySchemas1BoxedBoolean
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedNumber +data class AllofWithTwoEmptySchemas1BoxedNumber
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedString +data class AllofWithTwoEmptySchemas1BoxedString
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedList +data class AllofWithTwoEmptySchemas1BoxedList
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedMap +data class AllofWithTwoEmptySchemas1BoxedMap
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1 +class AllofWithTwoEmptySchemas1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Anyof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Anyof.md new file mode 100644 index 00000000000..0b400ccbe95 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Anyof.md @@ -0,0 +1,362 @@ +# Anyof +org.openapijsonschematools.client.components.schemas.Anyof.java +class Anyof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Anyof.Anyof1Boxed](#anyof1boxed)
sealed interface for validated payloads | +| record | [Anyof.Anyof1BoxedVoid](#anyof1boxedvoid)
boxed class to store validated null payloads | +| record | [Anyof.Anyof1BoxedBoolean](#anyof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Anyof.Anyof1BoxedNumber](#anyof1boxednumber)
boxed class to store validated Number payloads | +| record | [Anyof.Anyof1BoxedString](#anyof1boxedstring)
boxed class to store validated String payloads | +| record | [Anyof.Anyof1BoxedList](#anyof1boxedlist)
boxed class to store validated List payloads | +| record | [Anyof.Anyof1BoxedMap](#anyof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Anyof.Anyof1](#anyof1)
schema class | +| sealed interface | [Anyof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Anyof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Anyof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Anyof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Anyof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Anyof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Anyof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Anyof.Schema1](#schema1)
schema class | +| sealed interface | [Anyof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Anyof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [Anyof.Schema0](#schema0)
schema class | + +## Anyof1Boxed +sealed interface Anyof1Boxed
+permits
+[Anyof1BoxedVoid](#anyof1boxedvoid), +[Anyof1BoxedBoolean](#anyof1boxedboolean), +[Anyof1BoxedNumber](#anyof1boxednumber), +[Anyof1BoxedString](#anyof1boxedstring), +[Anyof1BoxedList](#anyof1boxedlist), +[Anyof1BoxedMap](#anyof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Anyof1BoxedVoid +data class Anyof1BoxedVoid
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedBoolean +data class Anyof1BoxedBoolean
+implements [Anyof1Boxed](#anyof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedNumber +data class Anyof1BoxedNumber
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedString +data class Anyof1BoxedString
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedList +data class Anyof1BoxedList
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedMap +data class Anyof1BoxedMap
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1 +class Anyof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Anyof1BoxedString](#anyof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Anyof1BoxedVoid](#anyof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Anyof1BoxedNumber](#anyof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Anyof1BoxedBoolean](#anyof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Anyof1BoxedMap](#anyof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Anyof1BoxedList](#anyof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Anyof1Boxed](#anyof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md new file mode 100644 index 00000000000..fa38731618a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md @@ -0,0 +1,674 @@ +# AnyofComplexTypes +org.openapijsonschematools.client.components.schemas.AnyofComplexTypes.java +class AnyofComplexTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AnyofComplexTypes.AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.AnyofComplexTypes1](#anyofcomplextypes1)
schema class | +| sealed interface | [AnyofComplexTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema1](#schema1)
schema class | +| static class | [AnyofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [AnyofComplexTypes.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [AnyofComplexTypes.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [AnyofComplexTypes.Foo](#foo)
schema class | +| sealed interface | [AnyofComplexTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema0](#schema0)
schema class | +| static class | [AnyofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AnyofComplexTypes.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AnyofComplexTypes.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [AnyofComplexTypes.Bar](#bar)
schema class | + +## AnyofComplexTypes1Boxed +sealed interface AnyofComplexTypes1Boxed
+permits
+[AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid), +[AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean), +[AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber), +[AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring), +[AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist), +[AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofComplexTypes1BoxedVoid +data class AnyofComplexTypes1BoxedVoid
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedBoolean +data class AnyofComplexTypes1BoxedBoolean
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedNumber +data class AnyofComplexTypes1BoxedNumber
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedString +data class AnyofComplexTypes1BoxedString
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedList +data class AnyofComplexTypes1BoxedList
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedMap +data class AnyofComplexTypes1BoxedMap
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1 +class AnyofComplexTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md new file mode 100644 index 00000000000..d0175fa0d3d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md @@ -0,0 +1,394 @@ +# AnyofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AnyofWithBaseSchema.java +class AnyofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithBaseSchema.AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| static class | [AnyofWithBaseSchema.AnyofWithBaseSchema1](#anyofwithbaseschema1)
schema class | +| sealed interface | [AnyofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema1](#schema1)
schema class | +| sealed interface | [AnyofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema0](#schema0)
schema class | + +## AnyofWithBaseSchema1Boxed +sealed interface AnyofWithBaseSchema1Boxed
+permits
+[AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithBaseSchema1BoxedString +data class AnyofWithBaseSchema1BoxedString
+implements [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithBaseSchema1 +class AnyofWithBaseSchema1
+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.AnyofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = AnyofWithBaseSchema.AnyofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md new file mode 100644 index 00000000000..9dacfd34348 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md @@ -0,0 +1,340 @@ +# AnyofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AnyofWithOneEmptySchema.java +class AnyofWithOneEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](#anyofwithoneemptyschema1)
schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [AnyofWithOneEmptySchema.Schema0](#schema0)
schema class | + +## AnyofWithOneEmptySchema1Boxed +sealed interface AnyofWithOneEmptySchema1Boxed
+permits
+[AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid), +[AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean), +[AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber), +[AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring), +[AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist), +[AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithOneEmptySchema1BoxedVoid +data class AnyofWithOneEmptySchema1BoxedVoid
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedBoolean +data class AnyofWithOneEmptySchema1BoxedBoolean
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedNumber +data class AnyofWithOneEmptySchema1BoxedNumber
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedString +data class AnyofWithOneEmptySchema1BoxedString
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedList +data class AnyofWithOneEmptySchema1BoxedList
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedMap +data class AnyofWithOneEmptySchema1BoxedMap
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1 +class AnyofWithOneEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md new file mode 100644 index 00000000000..c59750a9d4d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md @@ -0,0 +1,260 @@ +# ArrayTypeMatchesArrays +org.openapijsonschematools.client.components.schemas.ArrayTypeMatchesArrays.java +class ArrayTypeMatchesArrays
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed)
sealed interface for validated payloads | +| record | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](#arraytypematchesarrays1)
schema class | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArraysListBuilder](#arraytypematchesarrayslistbuilder)
builder for List payloads | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArraysList](#arraytypematchesarrayslist)
output class for List payloads | +| sealed interface | [ArrayTypeMatchesArrays.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ArrayTypeMatchesArrays.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ArrayTypeMatchesArrays.Items](#items)
schema class | + +## ArrayTypeMatchesArrays1Boxed +sealed interface ArrayTypeMatchesArrays1Boxed
+permits
+[ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayTypeMatchesArrays1BoxedList +data class ArrayTypeMatchesArrays1BoxedList
+implements [ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTypeMatchesArrays1BoxedList([ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## ArrayTypeMatchesArrays1 +class ArrayTypeMatchesArrays1
+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.ArrayTypeMatchesArrays; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ArrayTypeMatchesArrays.ArrayTypeMatchesArraysList validatedPayload = + ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.validate( + new ArrayTypeMatchesArrays.ArrayTypeMatchesArraysListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) | validate(arg: [List<*>](#arraytypematchesarrayslistbuilder), configuration: SchemaConfiguration) | +| [ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist) | validateAndBox([List<*>](#arraytypematchesarrayslistbuilder), configuration: SchemaConfiguration) | +| [ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ArrayTypeMatchesArraysListBuilder +class ArrayTypeMatchesArraysListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTypeMatchesArraysListBuilder()
Creates an empty list | +| ArrayTypeMatchesArraysListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ArrayTypeMatchesArraysListBuilder | add(item: Nothing?) | +| ArrayTypeMatchesArraysListBuilder | add(item: Boolean) | +| ArrayTypeMatchesArraysListBuilder | add(item: String) | +| ArrayTypeMatchesArraysListBuilder | add(item: Int) | +| ArrayTypeMatchesArraysListBuilder | add(item: Float) | +| ArrayTypeMatchesArraysListBuilder | add(item: Long) | +| ArrayTypeMatchesArraysListBuilder | add(item: Double) | +| ArrayTypeMatchesArraysListBuilder | add(item: List) | +| ArrayTypeMatchesArraysListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ArrayTypeMatchesArraysList +class ArrayTypeMatchesArraysList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ArrayTypeMatchesArraysList](#arraytypematchesarrayslist) | of([List](#arraytypematchesarrayslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedBoolean +data class ItemsBoxedBoolean
+implements [ItemsBoxed](#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 | +| Any? | getData()
validated payload | + +## ItemsBoxedNumber +data class ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## ItemsBoxedString +data class ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## ItemsBoxedList +data class ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedMap +data class ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md new file mode 100644 index 00000000000..e64f7f92c4a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md @@ -0,0 +1,52 @@ +# BooleanTypeMatchesBooleans +org.openapijsonschematools.client.components.schemas.BooleanTypeMatchesBooleans.java +class BooleanTypeMatchesBooleans
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed)
sealed interface for validated payloads | +| record | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](#booleantypematchesbooleans1)
schema class | + +## BooleanTypeMatchesBooleans1Boxed +sealed interface BooleanTypeMatchesBooleans1Boxed
+permits
+[BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## BooleanTypeMatchesBooleans1BoxedBoolean +data class BooleanTypeMatchesBooleans1BoxedBoolean
+implements [BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanTypeMatchesBooleans1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BooleanTypeMatchesBooleans1 +class BooleanTypeMatchesBooleans1
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByInt.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByInt.md new file mode 100644 index 00000000000..1d2e173784f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByInt.md @@ -0,0 +1,169 @@ +# ByInt +org.openapijsonschematools.client.components.schemas.ByInt.java +class ByInt
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByInt.ByInt1Boxed](#byint1boxed)
sealed interface for validated payloads | +| record | [ByInt.ByInt1BoxedVoid](#byint1boxedvoid)
boxed class to store validated null payloads | +| record | [ByInt.ByInt1BoxedBoolean](#byint1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ByInt.ByInt1BoxedNumber](#byint1boxednumber)
boxed class to store validated Number payloads | +| record | [ByInt.ByInt1BoxedString](#byint1boxedstring)
boxed class to store validated String payloads | +| record | [ByInt.ByInt1BoxedList](#byint1boxedlist)
boxed class to store validated List payloads | +| record | [ByInt.ByInt1BoxedMap](#byint1boxedmap)
boxed class to store validated Map payloads | +| static class | [ByInt.ByInt1](#byint1)
schema class | + +## ByInt1Boxed +sealed interface ByInt1Boxed
+permits
+[ByInt1BoxedVoid](#byint1boxedvoid), +[ByInt1BoxedBoolean](#byint1boxedboolean), +[ByInt1BoxedNumber](#byint1boxednumber), +[ByInt1BoxedString](#byint1boxedstring), +[ByInt1BoxedList](#byint1boxedlist), +[ByInt1BoxedMap](#byint1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByInt1BoxedVoid +data class ByInt1BoxedVoid
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedBoolean +data class ByInt1BoxedBoolean
+implements [ByInt1Boxed](#byint1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedNumber +data class ByInt1BoxedNumber
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedString +data class ByInt1BoxedString
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedList +data class ByInt1BoxedList
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedMap +data class ByInt1BoxedMap
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1 +class ByInt1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByInt1BoxedString](#byint1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByInt1BoxedVoid](#byint1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByInt1BoxedNumber](#byint1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByInt1BoxedBoolean](#byint1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByInt1BoxedMap](#byint1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByInt1BoxedList](#byint1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByInt1Boxed](#byint1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByNumber.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByNumber.md new file mode 100644 index 00000000000..0ef752b157e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ByNumber.md @@ -0,0 +1,169 @@ +# ByNumber +org.openapijsonschematools.client.components.schemas.ByNumber.java +class ByNumber
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByNumber.ByNumber1Boxed](#bynumber1boxed)
sealed interface for validated payloads | +| record | [ByNumber.ByNumber1BoxedVoid](#bynumber1boxedvoid)
boxed class to store validated null payloads | +| record | [ByNumber.ByNumber1BoxedBoolean](#bynumber1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ByNumber.ByNumber1BoxedNumber](#bynumber1boxednumber)
boxed class to store validated Number payloads | +| record | [ByNumber.ByNumber1BoxedString](#bynumber1boxedstring)
boxed class to store validated String payloads | +| record | [ByNumber.ByNumber1BoxedList](#bynumber1boxedlist)
boxed class to store validated List payloads | +| record | [ByNumber.ByNumber1BoxedMap](#bynumber1boxedmap)
boxed class to store validated Map payloads | +| static class | [ByNumber.ByNumber1](#bynumber1)
schema class | + +## ByNumber1Boxed +sealed interface ByNumber1Boxed
+permits
+[ByNumber1BoxedVoid](#bynumber1boxedvoid), +[ByNumber1BoxedBoolean](#bynumber1boxedboolean), +[ByNumber1BoxedNumber](#bynumber1boxednumber), +[ByNumber1BoxedString](#bynumber1boxedstring), +[ByNumber1BoxedList](#bynumber1boxedlist), +[ByNumber1BoxedMap](#bynumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByNumber1BoxedVoid +data class ByNumber1BoxedVoid
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedBoolean +data class ByNumber1BoxedBoolean
+implements [ByNumber1Boxed](#bynumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedNumber +data class ByNumber1BoxedNumber
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedString +data class ByNumber1BoxedString
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedList +data class ByNumber1BoxedList
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedMap +data class ByNumber1BoxedMap
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1 +class ByNumber1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("1.5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedString](#bynumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByNumber1BoxedVoid](#bynumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByNumber1BoxedNumber](#bynumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByNumber1BoxedBoolean](#bynumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByNumber1BoxedMap](#bynumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedList](#bynumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByNumber1Boxed](#bynumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BySmallNumber.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BySmallNumber.md new file mode 100644 index 00000000000..efb24198916 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/BySmallNumber.md @@ -0,0 +1,169 @@ +# BySmallNumber +org.openapijsonschematools.client.components.schemas.BySmallNumber.java +class BySmallNumber
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BySmallNumber.BySmallNumber1Boxed](#bysmallnumber1boxed)
sealed interface for validated payloads | +| record | [BySmallNumber.BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid)
boxed class to store validated null payloads | +| record | [BySmallNumber.BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean)
boxed class to store validated boolean payloads | +| record | [BySmallNumber.BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber)
boxed class to store validated Number payloads | +| record | [BySmallNumber.BySmallNumber1BoxedString](#bysmallnumber1boxedstring)
boxed class to store validated String payloads | +| record | [BySmallNumber.BySmallNumber1BoxedList](#bysmallnumber1boxedlist)
boxed class to store validated List payloads | +| record | [BySmallNumber.BySmallNumber1BoxedMap](#bysmallnumber1boxedmap)
boxed class to store validated Map payloads | +| static class | [BySmallNumber.BySmallNumber1](#bysmallnumber1)
schema class | + +## BySmallNumber1Boxed +sealed interface BySmallNumber1Boxed
+permits
+[BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid), +[BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean), +[BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber), +[BySmallNumber1BoxedString](#bysmallnumber1boxedstring), +[BySmallNumber1BoxedList](#bysmallnumber1boxedlist), +[BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BySmallNumber1BoxedVoid +data class BySmallNumber1BoxedVoid
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedBoolean +data class BySmallNumber1BoxedBoolean
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedNumber +data class BySmallNumber1BoxedNumber
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedString +data class BySmallNumber1BoxedString
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedList +data class BySmallNumber1BoxedList
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedMap +data class BySmallNumber1BoxedMap
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1 +class BySmallNumber1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("0.00010") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedString](#bysmallnumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedList](#bysmallnumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1Boxed](#bysmallnumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md new file mode 100644 index 00000000000..1844f22cea8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md @@ -0,0 +1,169 @@ +# DateTimeFormat +org.openapijsonschematools.client.components.schemas.DateTimeFormat.java +class DateTimeFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateTimeFormat.DateTimeFormat1Boxed](#datetimeformat1boxed)
sealed interface for validated payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid)
boxed class to store validated null payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber)
boxed class to store validated Number payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedString](#datetimeformat1boxedstring)
boxed class to store validated String payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedList](#datetimeformat1boxedlist)
boxed class to store validated List payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedMap](#datetimeformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [DateTimeFormat.DateTimeFormat1](#datetimeformat1)
schema class | + +## DateTimeFormat1Boxed +sealed interface DateTimeFormat1Boxed
+permits
+[DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid), +[DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean), +[DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber), +[DateTimeFormat1BoxedString](#datetimeformat1boxedstring), +[DateTimeFormat1BoxedList](#datetimeformat1boxedlist), +[DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeFormat1BoxedVoid +data class DateTimeFormat1BoxedVoid
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedBoolean +data class DateTimeFormat1BoxedBoolean
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedNumber +data class DateTimeFormat1BoxedNumber
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedString +data class DateTimeFormat1BoxedString
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedList +data class DateTimeFormat1BoxedList
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedMap +data class DateTimeFormat1BoxedMap
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1 +class DateTimeFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date-time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedString](#datetimeformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedList](#datetimeformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1Boxed](#datetimeformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EmailFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EmailFormat.md new file mode 100644 index 00000000000..53b4cde33e0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EmailFormat.md @@ -0,0 +1,169 @@ +# EmailFormat +org.openapijsonschematools.client.components.schemas.EmailFormat.java +class EmailFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EmailFormat.EmailFormat1Boxed](#emailformat1boxed)
sealed interface for validated payloads | +| record | [EmailFormat.EmailFormat1BoxedVoid](#emailformat1boxedvoid)
boxed class to store validated null payloads | +| record | [EmailFormat.EmailFormat1BoxedBoolean](#emailformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [EmailFormat.EmailFormat1BoxedNumber](#emailformat1boxednumber)
boxed class to store validated Number payloads | +| record | [EmailFormat.EmailFormat1BoxedString](#emailformat1boxedstring)
boxed class to store validated String payloads | +| record | [EmailFormat.EmailFormat1BoxedList](#emailformat1boxedlist)
boxed class to store validated List payloads | +| record | [EmailFormat.EmailFormat1BoxedMap](#emailformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [EmailFormat.EmailFormat1](#emailformat1)
schema class | + +## EmailFormat1Boxed +sealed interface EmailFormat1Boxed
+permits
+[EmailFormat1BoxedVoid](#emailformat1boxedvoid), +[EmailFormat1BoxedBoolean](#emailformat1boxedboolean), +[EmailFormat1BoxedNumber](#emailformat1boxednumber), +[EmailFormat1BoxedString](#emailformat1boxedstring), +[EmailFormat1BoxedList](#emailformat1boxedlist), +[EmailFormat1BoxedMap](#emailformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EmailFormat1BoxedVoid +data class EmailFormat1BoxedVoid
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedBoolean +data class EmailFormat1BoxedBoolean
+implements [EmailFormat1Boxed](#emailformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedNumber +data class EmailFormat1BoxedNumber
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedString +data class EmailFormat1BoxedString
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedList +data class EmailFormat1BoxedList
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedMap +data class EmailFormat1BoxedMap
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1 +class EmailFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "email"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedString](#emailformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedVoid](#emailformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedNumber](#emailformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedBoolean](#emailformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedMap](#emailformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedList](#emailformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1Boxed](#emailformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md new file mode 100644 index 00000000000..b33bd6fd650 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md @@ -0,0 +1,133 @@ +# EnumWith0DoesNotMatchFalse +org.openapijsonschematools.client.components.schemas.EnumWith0DoesNotMatchFalse.java +class EnumWith0DoesNotMatchFalse
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed)
sealed interface for validated payloads | +| record | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber)
boxed class to store validated Number payloads | +| static class | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](#enumwith0doesnotmatchfalse1)
schema class | +| enum | [EnumWith0DoesNotMatchFalse.IntegerEnumWith0DoesNotMatchFalseEnums](#integerenumwith0doesnotmatchfalseenums)
Integer enum | +| enum | [EnumWith0DoesNotMatchFalse.LongEnumWith0DoesNotMatchFalseEnums](#longenumwith0doesnotmatchfalseenums)
Long enum | +| enum | [EnumWith0DoesNotMatchFalse.FloatEnumWith0DoesNotMatchFalseEnums](#floatenumwith0doesnotmatchfalseenums)
Float enum | +| enum | [EnumWith0DoesNotMatchFalse.DoubleEnumWith0DoesNotMatchFalseEnums](#doubleenumwith0doesnotmatchfalseenums)
Double enum | + +## EnumWith0DoesNotMatchFalse1Boxed +sealed interface EnumWith0DoesNotMatchFalse1Boxed
+permits
+[EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith0DoesNotMatchFalse1BoxedNumber +data class EnumWith0DoesNotMatchFalse1BoxedNumber
+implements [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith0DoesNotMatchFalse1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWith0DoesNotMatchFalse1 +class EnumWith0DoesNotMatchFalse1
+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.EnumWith0DoesNotMatchFalse; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    0
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith0DoesNotMatchFalseEnums +public enum IntegerEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0 | + +## LongEnumWith0DoesNotMatchFalseEnums +public enum LongEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0L | + +## FloatEnumWith0DoesNotMatchFalseEnums +public enum FloatEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0f | + +## DoubleEnumWith0DoesNotMatchFalseEnums +public enum DoubleEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md new file mode 100644 index 00000000000..a296b3a613f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md @@ -0,0 +1,133 @@ +# EnumWith1DoesNotMatchTrue +org.openapijsonschematools.client.components.schemas.EnumWith1DoesNotMatchTrue.java +class EnumWith1DoesNotMatchTrue
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed)
sealed interface for validated payloads | +| record | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber)
boxed class to store validated Number payloads | +| static class | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](#enumwith1doesnotmatchtrue1)
schema class | +| enum | [EnumWith1DoesNotMatchTrue.IntegerEnumWith1DoesNotMatchTrueEnums](#integerenumwith1doesnotmatchtrueenums)
Integer enum | +| enum | [EnumWith1DoesNotMatchTrue.LongEnumWith1DoesNotMatchTrueEnums](#longenumwith1doesnotmatchtrueenums)
Long enum | +| enum | [EnumWith1DoesNotMatchTrue.FloatEnumWith1DoesNotMatchTrueEnums](#floatenumwith1doesnotmatchtrueenums)
Float enum | +| enum | [EnumWith1DoesNotMatchTrue.DoubleEnumWith1DoesNotMatchTrueEnums](#doubleenumwith1doesnotmatchtrueenums)
Double enum | + +## EnumWith1DoesNotMatchTrue1Boxed +sealed interface EnumWith1DoesNotMatchTrue1Boxed
+permits
+[EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith1DoesNotMatchTrue1BoxedNumber +data class EnumWith1DoesNotMatchTrue1BoxedNumber
+implements [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith1DoesNotMatchTrue1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWith1DoesNotMatchTrue1 +class EnumWith1DoesNotMatchTrue1
+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.EnumWith1DoesNotMatchTrue; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    1
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith1DoesNotMatchTrueEnums +public enum IntegerEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | + +## LongEnumWith1DoesNotMatchTrueEnums +public enum LongEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | + +## FloatEnumWith1DoesNotMatchTrueEnums +public enum FloatEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | + +## DoubleEnumWith1DoesNotMatchTrueEnums +public enum DoubleEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md new file mode 100644 index 00000000000..54458d5522a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md @@ -0,0 +1,99 @@ +# EnumWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.EnumWithEscapedCharacters.java +class EnumWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| static class | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](#enumwithescapedcharacters1)
schema class | +| enum | [EnumWithEscapedCharacters.StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums)
String enum | + +## EnumWithEscapedCharacters1Boxed +sealed interface EnumWithEscapedCharacters1Boxed
+permits
+[EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithEscapedCharacters1BoxedString +data class EnumWithEscapedCharacters1BoxedString
+implements [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithEscapedCharacters1 +class EnumWithEscapedCharacters1
+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.EnumWithEscapedCharacters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.validate( + "foo\nbar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "foo\nbar",
    "foo\rbar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums), configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringEnumWithEscapedCharactersEnums +public enum StringEnumWithEscapedCharactersEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO_LINE_FEED_LF_BAR | value = "foo\nbar" | +| FOO_CARRIAGE_RETURN_CR_BAR | value = "foo\rbar" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md new file mode 100644 index 00000000000..8055fb6b4d9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md @@ -0,0 +1,98 @@ +# EnumWithFalseDoesNotMatch0 +org.openapijsonschematools.client.components.schemas.EnumWithFalseDoesNotMatch0.java +class EnumWithFalseDoesNotMatch0
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed)
sealed interface for validated payloads | +| record | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean)
boxed class to store validated boolean payloads | +| static class | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](#enumwithfalsedoesnotmatch01)
schema class | +| enum | [EnumWithFalseDoesNotMatch0.BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums)
boolean enum | + +## EnumWithFalseDoesNotMatch01Boxed +sealed interface EnumWithFalseDoesNotMatch01Boxed
+permits
+[EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithFalseDoesNotMatch01BoxedBoolean +data class EnumWithFalseDoesNotMatch01BoxedBoolean
+implements [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithFalseDoesNotMatch01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithFalseDoesNotMatch01 +class EnumWithFalseDoesNotMatch01
+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.EnumWithFalseDoesNotMatch0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.validate( + false, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
    false
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums), configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithFalseDoesNotMatch0Enums +public enum BooleanEnumWithFalseDoesNotMatch0Enums
+extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FALSE | value = false | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md new file mode 100644 index 00000000000..c22cd9303bb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md @@ -0,0 +1,98 @@ +# EnumWithTrueDoesNotMatch1 +org.openapijsonschematools.client.components.schemas.EnumWithTrueDoesNotMatch1.java +class EnumWithTrueDoesNotMatch1
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed)
sealed interface for validated payloads | +| record | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean)
boxed class to store validated boolean payloads | +| static class | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](#enumwithtruedoesnotmatch11)
schema class | +| enum | [EnumWithTrueDoesNotMatch1.BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums)
boolean enum | + +## EnumWithTrueDoesNotMatch11Boxed +sealed interface EnumWithTrueDoesNotMatch11Boxed
+permits
+[EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithTrueDoesNotMatch11BoxedBoolean +data class EnumWithTrueDoesNotMatch11BoxedBoolean
+implements [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithTrueDoesNotMatch11BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithTrueDoesNotMatch11 +class EnumWithTrueDoesNotMatch11
+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.EnumWithTrueDoesNotMatch1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
    true
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums), configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithTrueDoesNotMatch1Enums +public enum BooleanEnumWithTrueDoesNotMatch1Enums
+extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRUE | value = true | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md new file mode 100644 index 00000000000..dad4dd136ad --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md @@ -0,0 +1,320 @@ +# EnumsInProperties +org.openapijsonschematools.client.components.schemas.EnumsInProperties.java +class EnumsInProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumsInProperties.EnumsInProperties1Boxed](#enumsinproperties1boxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [EnumsInProperties.EnumsInProperties1](#enumsinproperties1)
schema class | +| static class | [EnumsInProperties.EnumsInPropertiesMapBuilder](#enumsinpropertiesmapbuilder)
builder for Map payloads | +| static class | [EnumsInProperties.EnumsInPropertiesMap](#enumsinpropertiesmap)
output class for Map payloads | +| sealed interface | [EnumsInProperties.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [EnumsInProperties.Bar](#bar)
schema class | +| enum | [EnumsInProperties.StringBarEnums](#stringbarenums)
String enum | +| sealed interface | [EnumsInProperties.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [EnumsInProperties.Foo](#foo)
schema class | +| enum | [EnumsInProperties.StringFooEnums](#stringfooenums)
String enum | + +## EnumsInProperties1Boxed +sealed interface EnumsInProperties1Boxed
+permits
+[EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EnumsInProperties1BoxedMap +data class EnumsInProperties1BoxedMap
+implements [EnumsInProperties1Boxed](#enumsinproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInProperties1BoxedMap([EnumsInPropertiesMap](#enumsinpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumsInProperties1 +class EnumsInProperties1
+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.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +EnumsInProperties.EnumsInPropertiesMap validatedPayload = + EnumsInProperties.EnumsInProperties1.validate( + new EnumsInProperties.EnumsInPropertiesMapBuilder() + .bar("bar") + + .foo("foo") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | validate(arg: [Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) | validateAndBox([Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1Boxed](#enumsinproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## EnumsInPropertiesMap0Builder +class EnumsInPropertiesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: [StringFooEnums](#stringfooenums)) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Boolean) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Int) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Float) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Long) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Double) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: List) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Map) | + +## EnumsInPropertiesMapBuilder +class EnumsInPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: [StringBarEnums](#stringbarenums)) | + +## EnumsInPropertiesMap +class EnumsInPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [EnumsInPropertiesMap](#enumsinpropertiesmap) | of([Map](#enumsinpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
must be one of ["bar"] | +| String | foo()
[optional] must be one of ["foo"] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+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.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Bar.validate( + "bar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringBarEnums](#stringbarenums), configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringBarEnums +public enum StringBarEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| BAR | value = "bar" | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+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.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Foo.validate( + "foo", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringFooEnums](#stringfooenums), configuration: SchemaConfiguration) | +| [FooBoxedString](#fooboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringFooEnums +public enum StringFooEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO | value = "foo" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md new file mode 100644 index 00000000000..59362492629 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md @@ -0,0 +1,353 @@ +# ForbiddenProperty +org.openapijsonschematools.client.components.schemas.ForbiddenProperty.java +class ForbiddenProperty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ForbiddenProperty.ForbiddenProperty1Boxed](#forbiddenproperty1boxed)
sealed interface for validated payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid)
boxed class to store validated null payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber)
boxed class to store validated Number payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring)
boxed class to store validated String payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist)
boxed class to store validated List payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap)
boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.ForbiddenProperty1](#forbiddenproperty1)
schema class | +| static class | [ForbiddenProperty.ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder)
builder for Map payloads | +| static class | [ForbiddenProperty.ForbiddenPropertyMap](#forbiddenpropertymap)
output class for Map payloads | +| sealed interface | [ForbiddenProperty.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [ForbiddenProperty.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [ForbiddenProperty.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [ForbiddenProperty.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [ForbiddenProperty.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [ForbiddenProperty.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.Foo](#foo)
schema class | + +## ForbiddenProperty1Boxed +sealed interface ForbiddenProperty1Boxed
+permits
+[ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid), +[ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean), +[ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber), +[ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring), +[ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist), +[ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ForbiddenProperty1BoxedVoid +data class ForbiddenProperty1BoxedVoid
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedBoolean +data class ForbiddenProperty1BoxedBoolean
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedNumber +data class ForbiddenProperty1BoxedNumber
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedString +data class ForbiddenProperty1BoxedString
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedList +data class ForbiddenProperty1BoxedList
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedMap +data class ForbiddenProperty1BoxedMap
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedMap([ForbiddenPropertyMap](#forbiddenpropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1 +class ForbiddenProperty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | validate(arg: [Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) | validateAndBox([Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ForbiddenPropertyMapBuilder +class ForbiddenPropertyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Map) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Map) | + +## ForbiddenPropertyMap +class ForbiddenPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ForbiddenPropertyMap](#forbiddenpropertymap) | of([Map](#forbiddenpropertymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/HostnameFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/HostnameFormat.md new file mode 100644 index 00000000000..9bfb2c2b465 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/HostnameFormat.md @@ -0,0 +1,169 @@ +# HostnameFormat +org.openapijsonschematools.client.components.schemas.HostnameFormat.java +class HostnameFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [HostnameFormat.HostnameFormat1Boxed](#hostnameformat1boxed)
sealed interface for validated payloads | +| record | [HostnameFormat.HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid)
boxed class to store validated null payloads | +| record | [HostnameFormat.HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [HostnameFormat.HostnameFormat1BoxedNumber](#hostnameformat1boxednumber)
boxed class to store validated Number payloads | +| record | [HostnameFormat.HostnameFormat1BoxedString](#hostnameformat1boxedstring)
boxed class to store validated String payloads | +| record | [HostnameFormat.HostnameFormat1BoxedList](#hostnameformat1boxedlist)
boxed class to store validated List payloads | +| record | [HostnameFormat.HostnameFormat1BoxedMap](#hostnameformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [HostnameFormat.HostnameFormat1](#hostnameformat1)
schema class | + +## HostnameFormat1Boxed +sealed interface HostnameFormat1Boxed
+permits
+[HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid), +[HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean), +[HostnameFormat1BoxedNumber](#hostnameformat1boxednumber), +[HostnameFormat1BoxedString](#hostnameformat1boxedstring), +[HostnameFormat1BoxedList](#hostnameformat1boxedlist), +[HostnameFormat1BoxedMap](#hostnameformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HostnameFormat1BoxedVoid +data class HostnameFormat1BoxedVoid
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedBoolean +data class HostnameFormat1BoxedBoolean
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedNumber +data class HostnameFormat1BoxedNumber
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedString +data class HostnameFormat1BoxedString
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedList +data class HostnameFormat1BoxedList
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedMap +data class HostnameFormat1BoxedMap
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1 +class HostnameFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "hostname"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedString](#hostnameformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedNumber](#hostnameformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedMap](#hostnameformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedList](#hostnameformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1Boxed](#hostnameformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md new file mode 100644 index 00000000000..39131a09a05 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md @@ -0,0 +1,52 @@ +# IntegerTypeMatchesIntegers +org.openapijsonschematools.client.components.schemas.IntegerTypeMatchesIntegers.java +class IntegerTypeMatchesIntegers
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed)
sealed interface for validated payloads | +| record | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](#integertypematchesintegers1)
schema class | + +## IntegerTypeMatchesIntegers1Boxed +sealed interface IntegerTypeMatchesIntegers1Boxed
+permits
+[IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerTypeMatchesIntegers1BoxedNumber +data class IntegerTypeMatchesIntegers1BoxedNumber
+implements [IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerTypeMatchesIntegers1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IntegerTypeMatchesIntegers1 +class IntegerTypeMatchesIntegers1
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md new file mode 100644 index 00000000000..75d8899d5fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.md @@ -0,0 +1,85 @@ +# InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf +org.openapijsonschematools.client.components.schemas.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.java +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxed)
sealed interface for validated payloads | +| record | [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxednumber)
boxed class to store validated Number payloads | +| static class | [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1)
schema class | + +## InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed +sealed interface InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed
+permits
+[InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber +data class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber
+implements [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1
+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.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| String | type = "int"; | +| BigDecimal | multipleOf = BigDecimal("0.123456789") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed](#invalidinstanceshouldnotraiseerrorwhenfloatdivisioninf1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidStringValueForDefault.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidStringValueForDefault.md new file mode 100644 index 00000000000..d94689558b8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/InvalidStringValueForDefault.md @@ -0,0 +1,283 @@ +# InvalidStringValueForDefault +org.openapijsonschematools.client.components.schemas.InvalidStringValueForDefault.java +class InvalidStringValueForDefault
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [InvalidStringValueForDefault.InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed)
sealed interface for validated payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedVoid](#invalidstringvaluefordefault1boxedvoid)
boxed class to store validated null payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedBoolean](#invalidstringvaluefordefault1boxedboolean)
boxed class to store validated boolean payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedNumber](#invalidstringvaluefordefault1boxednumber)
boxed class to store validated Number payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedString](#invalidstringvaluefordefault1boxedstring)
boxed class to store validated String payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedList](#invalidstringvaluefordefault1boxedlist)
boxed class to store validated List payloads | +| record | [InvalidStringValueForDefault.InvalidStringValueForDefault1BoxedMap](#invalidstringvaluefordefault1boxedmap)
boxed class to store validated Map payloads | +| static class | [InvalidStringValueForDefault.InvalidStringValueForDefault1](#invalidstringvaluefordefault1)
schema class | +| static class | [InvalidStringValueForDefault.InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder)
builder for Map payloads | +| static class | [InvalidStringValueForDefault.InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap)
output class for Map payloads | +| sealed interface | [InvalidStringValueForDefault.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [InvalidStringValueForDefault.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [InvalidStringValueForDefault.Bar](#bar)
schema class | + +## InvalidStringValueForDefault1Boxed +sealed interface InvalidStringValueForDefault1Boxed
+permits
+[InvalidStringValueForDefault1BoxedVoid](#invalidstringvaluefordefault1boxedvoid), +[InvalidStringValueForDefault1BoxedBoolean](#invalidstringvaluefordefault1boxedboolean), +[InvalidStringValueForDefault1BoxedNumber](#invalidstringvaluefordefault1boxednumber), +[InvalidStringValueForDefault1BoxedString](#invalidstringvaluefordefault1boxedstring), +[InvalidStringValueForDefault1BoxedList](#invalidstringvaluefordefault1boxedlist), +[InvalidStringValueForDefault1BoxedMap](#invalidstringvaluefordefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## InvalidStringValueForDefault1BoxedVoid +data class InvalidStringValueForDefault1BoxedVoid
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedBoolean +data class InvalidStringValueForDefault1BoxedBoolean
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedNumber +data class InvalidStringValueForDefault1BoxedNumber
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedString +data class InvalidStringValueForDefault1BoxedString
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedList +data class InvalidStringValueForDefault1BoxedList
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1BoxedMap +data class InvalidStringValueForDefault1BoxedMap
+implements [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefault1BoxedMap([InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## InvalidStringValueForDefault1 +class InvalidStringValueForDefault1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) | validate(arg: [Map<?, ?>](#invalidstringvaluefordefaultmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedString](#invalidstringvaluefordefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedVoid](#invalidstringvaluefordefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedNumber](#invalidstringvaluefordefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedBoolean](#invalidstringvaluefordefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedMap](#invalidstringvaluefordefault1boxedmap) | validateAndBox([Map<?, ?>](#invalidstringvaluefordefaultmapbuilder), configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1BoxedList](#invalidstringvaluefordefault1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [InvalidStringValueForDefault1Boxed](#invalidstringvaluefordefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## InvalidStringValueForDefaultMapBuilder +class InvalidStringValueForDefaultMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| InvalidStringValueForDefaultMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | bar(value: String) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: String) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Int) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Float) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Long) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Double) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: List) | +| [InvalidStringValueForDefaultMapBuilder](#invalidstringvaluefordefaultmapbuilder) | additionalProperty(key: String, value: Map) | + +## InvalidStringValueForDefaultMap +class InvalidStringValueForDefaultMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [InvalidStringValueForDefaultMap](#invalidstringvaluefordefaultmap) | of([Map](#invalidstringvaluefordefaultmapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
[optional] if omitted the server will use the default value of bad | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+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.InvalidStringValueForDefault; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = InvalidStringValueForDefault.Bar.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Integer | minLength = 4 | +| Any? | defaultValue = "bad" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv4Format.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv4Format.md new file mode 100644 index 00000000000..0ddec8c4233 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv4Format.md @@ -0,0 +1,169 @@ +# Ipv4Format +org.openapijsonschematools.client.components.schemas.Ipv4Format.java +class Ipv4Format
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv4Format.Ipv4Format1Boxed](#ipv4format1boxed)
sealed interface for validated payloads | +| record | [Ipv4Format.Ipv4Format1BoxedVoid](#ipv4format1boxedvoid)
boxed class to store validated null payloads | +| record | [Ipv4Format.Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Ipv4Format.Ipv4Format1BoxedNumber](#ipv4format1boxednumber)
boxed class to store validated Number payloads | +| record | [Ipv4Format.Ipv4Format1BoxedString](#ipv4format1boxedstring)
boxed class to store validated String payloads | +| record | [Ipv4Format.Ipv4Format1BoxedList](#ipv4format1boxedlist)
boxed class to store validated List payloads | +| record | [Ipv4Format.Ipv4Format1BoxedMap](#ipv4format1boxedmap)
boxed class to store validated Map payloads | +| static class | [Ipv4Format.Ipv4Format1](#ipv4format1)
schema class | + +## Ipv4Format1Boxed +sealed interface Ipv4Format1Boxed
+permits
+[Ipv4Format1BoxedVoid](#ipv4format1boxedvoid), +[Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean), +[Ipv4Format1BoxedNumber](#ipv4format1boxednumber), +[Ipv4Format1BoxedString](#ipv4format1boxedstring), +[Ipv4Format1BoxedList](#ipv4format1boxedlist), +[Ipv4Format1BoxedMap](#ipv4format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv4Format1BoxedVoid +data class Ipv4Format1BoxedVoid
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedBoolean +data class Ipv4Format1BoxedBoolean
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedNumber +data class Ipv4Format1BoxedNumber
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedString +data class Ipv4Format1BoxedString
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedList +data class Ipv4Format1BoxedList
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedMap +data class Ipv4Format1BoxedMap
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1 +class Ipv4Format1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv4"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedString](#ipv4format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedVoid](#ipv4format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedNumber](#ipv4format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedMap](#ipv4format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedList](#ipv4format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1Boxed](#ipv4format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv6Format.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv6Format.md new file mode 100644 index 00000000000..d78fd50c8b4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Ipv6Format.md @@ -0,0 +1,169 @@ +# Ipv6Format +org.openapijsonschematools.client.components.schemas.Ipv6Format.java +class Ipv6Format
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv6Format.Ipv6Format1Boxed](#ipv6format1boxed)
sealed interface for validated payloads | +| record | [Ipv6Format.Ipv6Format1BoxedVoid](#ipv6format1boxedvoid)
boxed class to store validated null payloads | +| record | [Ipv6Format.Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Ipv6Format.Ipv6Format1BoxedNumber](#ipv6format1boxednumber)
boxed class to store validated Number payloads | +| record | [Ipv6Format.Ipv6Format1BoxedString](#ipv6format1boxedstring)
boxed class to store validated String payloads | +| record | [Ipv6Format.Ipv6Format1BoxedList](#ipv6format1boxedlist)
boxed class to store validated List payloads | +| record | [Ipv6Format.Ipv6Format1BoxedMap](#ipv6format1boxedmap)
boxed class to store validated Map payloads | +| static class | [Ipv6Format.Ipv6Format1](#ipv6format1)
schema class | + +## Ipv6Format1Boxed +sealed interface Ipv6Format1Boxed
+permits
+[Ipv6Format1BoxedVoid](#ipv6format1boxedvoid), +[Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean), +[Ipv6Format1BoxedNumber](#ipv6format1boxednumber), +[Ipv6Format1BoxedString](#ipv6format1boxedstring), +[Ipv6Format1BoxedList](#ipv6format1boxedlist), +[Ipv6Format1BoxedMap](#ipv6format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv6Format1BoxedVoid +data class Ipv6Format1BoxedVoid
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedBoolean +data class Ipv6Format1BoxedBoolean
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedNumber +data class Ipv6Format1BoxedNumber
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedString +data class Ipv6Format1BoxedString
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedList +data class Ipv6Format1BoxedList
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedMap +data class Ipv6Format1BoxedMap
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1 +class Ipv6Format1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv6"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedString](#ipv6format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedVoid](#ipv6format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedNumber](#ipv6format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedMap](#ipv6format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedList](#ipv6format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1Boxed](#ipv6format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md new file mode 100644 index 00000000000..6eddd588dff --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md @@ -0,0 +1,169 @@ +# JsonPointerFormat +org.openapijsonschematools.client.components.schemas.JsonPointerFormat.java +class JsonPointerFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [JsonPointerFormat.JsonPointerFormat1Boxed](#jsonpointerformat1boxed)
sealed interface for validated payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid)
boxed class to store validated null payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber)
boxed class to store validated Number payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring)
boxed class to store validated String payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist)
boxed class to store validated List payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [JsonPointerFormat.JsonPointerFormat1](#jsonpointerformat1)
schema class | + +## JsonPointerFormat1Boxed +sealed interface JsonPointerFormat1Boxed
+permits
+[JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid), +[JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean), +[JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber), +[JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring), +[JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist), +[JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## JsonPointerFormat1BoxedVoid +data class JsonPointerFormat1BoxedVoid
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedBoolean +data class JsonPointerFormat1BoxedBoolean
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedNumber +data class JsonPointerFormat1BoxedNumber
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedString +data class JsonPointerFormat1BoxedString
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedList +data class JsonPointerFormat1BoxedList
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedMap +data class JsonPointerFormat1BoxedMap
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1 +class JsonPointerFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "json-pointer"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidation.md new file mode 100644 index 00000000000..30da56e71cc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidation.md @@ -0,0 +1,169 @@ +# MaximumValidation +org.openapijsonschematools.client.components.schemas.MaximumValidation.java +class MaximumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidation.MaximumValidation1Boxed](#maximumvalidation1boxed)
sealed interface for validated payloads | +| record | [MaximumValidation.MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaximumValidation.MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaximumValidation.MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaximumValidation.MaximumValidation1BoxedString](#maximumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaximumValidation.MaximumValidation1BoxedList](#maximumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaximumValidation.MaximumValidation1BoxedMap](#maximumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaximumValidation.MaximumValidation1](#maximumvalidation1)
schema class | + +## MaximumValidation1Boxed +sealed interface MaximumValidation1Boxed
+permits
+[MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid), +[MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean), +[MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber), +[MaximumValidation1BoxedString](#maximumvalidation1boxedstring), +[MaximumValidation1BoxedList](#maximumvalidation1boxedlist), +[MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidation1BoxedVoid +data class MaximumValidation1BoxedVoid
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedBoolean +data class MaximumValidation1BoxedBoolean
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedNumber +data class MaximumValidation1BoxedNumber
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedString +data class MaximumValidation1BoxedString
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedList +data class MaximumValidation1BoxedList
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedMap +data class MaximumValidation1BoxedMap
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1 +class MaximumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 3.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedString](#maximumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedList](#maximumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1Boxed](#maximumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md new file mode 100644 index 00000000000..c9730a8592b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md @@ -0,0 +1,169 @@ +# MaximumValidationWithUnsignedInteger +org.openapijsonschematools.client.components.schemas.MaximumValidationWithUnsignedInteger.java +class MaximumValidationWithUnsignedInteger
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed)
sealed interface for validated payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid)
boxed class to store validated null payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber)
boxed class to store validated Number payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring)
boxed class to store validated String payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist)
boxed class to store validated List payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](#maximumvalidationwithunsignedinteger1)
schema class | + +## MaximumValidationWithUnsignedInteger1Boxed +sealed interface MaximumValidationWithUnsignedInteger1Boxed
+permits
+[MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid), +[MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean), +[MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber), +[MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring), +[MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist), +[MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidationWithUnsignedInteger1BoxedVoid +data class MaximumValidationWithUnsignedInteger1BoxedVoid
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedBoolean +data class MaximumValidationWithUnsignedInteger1BoxedBoolean
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedNumber +data class MaximumValidationWithUnsignedInteger1BoxedNumber
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedString +data class MaximumValidationWithUnsignedInteger1BoxedString
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedList +data class MaximumValidationWithUnsignedInteger1BoxedList
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedMap +data class MaximumValidationWithUnsignedInteger1BoxedMap
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1 +class MaximumValidationWithUnsignedInteger1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 300 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md new file mode 100644 index 00000000000..3ea5955c1d2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md @@ -0,0 +1,169 @@ +# MaxitemsValidation +org.openapijsonschematools.client.components.schemas.MaxitemsValidation.java +class MaxitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxitemsValidation.MaxitemsValidation1Boxed](#maxitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxitemsValidation.MaxitemsValidation1](#maxitemsvalidation1)
schema class | + +## MaxitemsValidation1Boxed +sealed interface MaxitemsValidation1Boxed
+permits
+[MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid), +[MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean), +[MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber), +[MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring), +[MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist), +[MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxitemsValidation1BoxedVoid +data class MaxitemsValidation1BoxedVoid
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedBoolean +data class MaxitemsValidation1BoxedBoolean
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedNumber +data class MaxitemsValidation1BoxedNumber
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedString +data class MaxitemsValidation1BoxedString
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedList +data class MaxitemsValidation1BoxedList
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedMap +data class MaxitemsValidation1BoxedMap
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1 +class MaxitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxItems = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md new file mode 100644 index 00000000000..bce5aed91d9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md @@ -0,0 +1,169 @@ +# MaxlengthValidation +org.openapijsonschematools.client.components.schemas.MaxlengthValidation.java +class MaxlengthValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxlengthValidation.MaxlengthValidation1Boxed](#maxlengthvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxlengthValidation.MaxlengthValidation1](#maxlengthvalidation1)
schema class | + +## MaxlengthValidation1Boxed +sealed interface MaxlengthValidation1Boxed
+permits
+[MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid), +[MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean), +[MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber), +[MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring), +[MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist), +[MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxlengthValidation1BoxedVoid +data class MaxlengthValidation1BoxedVoid
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedBoolean +data class MaxlengthValidation1BoxedBoolean
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedNumber +data class MaxlengthValidation1BoxedNumber
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedString +data class MaxlengthValidation1BoxedString
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedList +data class MaxlengthValidation1BoxedList
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedMap +data class MaxlengthValidation1BoxedMap
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1 +class MaxlengthValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md new file mode 100644 index 00000000000..06a37326fda --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md @@ -0,0 +1,169 @@ +# Maxproperties0MeansTheObjectIsEmpty +org.openapijsonschematools.client.components.schemas.Maxproperties0MeansTheObjectIsEmpty.java +class Maxproperties0MeansTheObjectIsEmpty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed)
sealed interface for validated payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid)
boxed class to store validated null payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber)
boxed class to store validated Number payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring)
boxed class to store validated String payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist)
boxed class to store validated List payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap)
boxed class to store validated Map payloads | +| static class | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](#maxproperties0meanstheobjectisempty1)
schema class | + +## Maxproperties0MeansTheObjectIsEmpty1Boxed +sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed
+permits
+[Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid), +[Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean), +[Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber), +[Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring), +[Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist), +[Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Maxproperties0MeansTheObjectIsEmpty1BoxedVoid +data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean +data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedNumber +data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedString +data class Maxproperties0MeansTheObjectIsEmpty1BoxedString
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedList +data class Maxproperties0MeansTheObjectIsEmpty1BoxedList
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedMap +data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1 +class Maxproperties0MeansTheObjectIsEmpty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md new file mode 100644 index 00000000000..8b04a4d21ac --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md @@ -0,0 +1,169 @@ +# MaxpropertiesValidation +org.openapijsonschematools.client.components.schemas.MaxpropertiesValidation.java +class MaxpropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxpropertiesValidation.MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxpropertiesValidation.MaxpropertiesValidation1](#maxpropertiesvalidation1)
schema class | + +## MaxpropertiesValidation1Boxed +sealed interface MaxpropertiesValidation1Boxed
+permits
+[MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid), +[MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean), +[MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber), +[MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring), +[MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist), +[MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxpropertiesValidation1BoxedVoid +data class MaxpropertiesValidation1BoxedVoid
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedBoolean +data class MaxpropertiesValidation1BoxedBoolean
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedNumber +data class MaxpropertiesValidation1BoxedNumber
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedString +data class MaxpropertiesValidation1BoxedString
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedList +data class MaxpropertiesValidation1BoxedList
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedMap +data class MaxpropertiesValidation1BoxedMap
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1 +class MaxpropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidation.md new file mode 100644 index 00000000000..94694cf69ec --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidation.md @@ -0,0 +1,169 @@ +# MinimumValidation +org.openapijsonschematools.client.components.schemas.MinimumValidation.java +class MinimumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidation.MinimumValidation1Boxed](#minimumvalidation1boxed)
sealed interface for validated payloads | +| record | [MinimumValidation.MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinimumValidation.MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinimumValidation.MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinimumValidation.MinimumValidation1BoxedString](#minimumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinimumValidation.MinimumValidation1BoxedList](#minimumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinimumValidation.MinimumValidation1BoxedMap](#minimumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinimumValidation.MinimumValidation1](#minimumvalidation1)
schema class | + +## MinimumValidation1Boxed +sealed interface MinimumValidation1Boxed
+permits
+[MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid), +[MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean), +[MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber), +[MinimumValidation1BoxedString](#minimumvalidation1boxedstring), +[MinimumValidation1BoxedList](#minimumvalidation1boxedlist), +[MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidation1BoxedVoid +data class MinimumValidation1BoxedVoid
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedBoolean +data class MinimumValidation1BoxedBoolean
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedNumber +data class MinimumValidation1BoxedNumber
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedString +data class MinimumValidation1BoxedString
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedList +data class MinimumValidation1BoxedList
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedMap +data class MinimumValidation1BoxedMap
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1 +class MinimumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 1.1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedString](#minimumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedList](#minimumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1Boxed](#minimumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md new file mode 100644 index 00000000000..b898faa9cd1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md @@ -0,0 +1,169 @@ +# MinimumValidationWithSignedInteger +org.openapijsonschematools.client.components.schemas.MinimumValidationWithSignedInteger.java +class MinimumValidationWithSignedInteger
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed)
sealed interface for validated payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid)
boxed class to store validated null payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber)
boxed class to store validated Number payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring)
boxed class to store validated String payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist)
boxed class to store validated List payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](#minimumvalidationwithsignedinteger1)
schema class | + +## MinimumValidationWithSignedInteger1Boxed +sealed interface MinimumValidationWithSignedInteger1Boxed
+permits
+[MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid), +[MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean), +[MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber), +[MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring), +[MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist), +[MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidationWithSignedInteger1BoxedVoid +data class MinimumValidationWithSignedInteger1BoxedVoid
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedBoolean +data class MinimumValidationWithSignedInteger1BoxedBoolean
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedNumber +data class MinimumValidationWithSignedInteger1BoxedNumber
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedString +data class MinimumValidationWithSignedInteger1BoxedString
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedList +data class MinimumValidationWithSignedInteger1BoxedList
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedMap +data class MinimumValidationWithSignedInteger1BoxedMap
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1 +class MinimumValidationWithSignedInteger1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md new file mode 100644 index 00000000000..e095c974cd9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md @@ -0,0 +1,169 @@ +# MinitemsValidation +org.openapijsonschematools.client.components.schemas.MinitemsValidation.java +class MinitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinitemsValidation.MinitemsValidation1Boxed](#minitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinitemsValidation.MinitemsValidation1](#minitemsvalidation1)
schema class | + +## MinitemsValidation1Boxed +sealed interface MinitemsValidation1Boxed
+permits
+[MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid), +[MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean), +[MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber), +[MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring), +[MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist), +[MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinitemsValidation1BoxedVoid +data class MinitemsValidation1BoxedVoid
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedBoolean +data class MinitemsValidation1BoxedBoolean
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedNumber +data class MinitemsValidation1BoxedNumber
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedString +data class MinitemsValidation1BoxedString
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedList +data class MinitemsValidation1BoxedList
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedMap +data class MinitemsValidation1BoxedMap
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1 +class MinitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minItems = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1Boxed](#minitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md new file mode 100644 index 00000000000..3905f4a2411 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md @@ -0,0 +1,169 @@ +# MinlengthValidation +org.openapijsonschematools.client.components.schemas.MinlengthValidation.java +class MinlengthValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinlengthValidation.MinlengthValidation1Boxed](#minlengthvalidation1boxed)
sealed interface for validated payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinlengthValidation.MinlengthValidation1](#minlengthvalidation1)
schema class | + +## MinlengthValidation1Boxed +sealed interface MinlengthValidation1Boxed
+permits
+[MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid), +[MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean), +[MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber), +[MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring), +[MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist), +[MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinlengthValidation1BoxedVoid +data class MinlengthValidation1BoxedVoid
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedBoolean +data class MinlengthValidation1BoxedBoolean
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedNumber +data class MinlengthValidation1BoxedNumber
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedString +data class MinlengthValidation1BoxedString
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedList +data class MinlengthValidation1BoxedList
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedMap +data class MinlengthValidation1BoxedMap
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1 +class MinlengthValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1Boxed](#minlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md new file mode 100644 index 00000000000..27161315772 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md @@ -0,0 +1,169 @@ +# MinpropertiesValidation +org.openapijsonschematools.client.components.schemas.MinpropertiesValidation.java +class MinpropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinpropertiesValidation.MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinpropertiesValidation.MinpropertiesValidation1](#minpropertiesvalidation1)
schema class | + +## MinpropertiesValidation1Boxed +sealed interface MinpropertiesValidation1Boxed
+permits
+[MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid), +[MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean), +[MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber), +[MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring), +[MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist), +[MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinpropertiesValidation1BoxedVoid +data class MinpropertiesValidation1BoxedVoid
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedBoolean +data class MinpropertiesValidation1BoxedBoolean
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedNumber +data class MinpropertiesValidation1BoxedNumber
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedString +data class MinpropertiesValidation1BoxedString
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedList +data class MinpropertiesValidation1BoxedList
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedMap +data class MinpropertiesValidation1BoxedMap
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1 +class MinpropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minProperties = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md new file mode 100644 index 00000000000..708628006e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAllofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAllofToCheckValidationSemantics.java +class NestedAllofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](#nestedalloftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedAllofToCheckValidationSemantics1Boxed +sealed interface NestedAllofToCheckValidationSemantics1Boxed
+permits
+[NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid), +[NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean), +[NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber), +[NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring), +[NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist), +[NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAllofToCheckValidationSemantics1BoxedVoid +data class NestedAllofToCheckValidationSemantics1BoxedVoid
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedBoolean +data class NestedAllofToCheckValidationSemantics1BoxedBoolean
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedNumber +data class NestedAllofToCheckValidationSemantics1BoxedNumber
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedString +data class NestedAllofToCheckValidationSemantics1BoxedString
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedList +data class NestedAllofToCheckValidationSemantics1BoxedList
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedMap +data class NestedAllofToCheckValidationSemantics1BoxedMap
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1 +class NestedAllofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema01::class.java](#schema01)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md new file mode 100644 index 00000000000..d145f8fdf0a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAnyofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAnyofToCheckValidationSemantics.java +class NestedAnyofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](#nestedanyoftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedAnyofToCheckValidationSemantics1Boxed +sealed interface NestedAnyofToCheckValidationSemantics1Boxed
+permits
+[NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid), +[NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean), +[NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber), +[NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring), +[NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist), +[NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAnyofToCheckValidationSemantics1BoxedVoid +data class NestedAnyofToCheckValidationSemantics1BoxedVoid
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedBoolean +data class NestedAnyofToCheckValidationSemantics1BoxedBoolean
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedNumber +data class NestedAnyofToCheckValidationSemantics1BoxedNumber
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedString +data class NestedAnyofToCheckValidationSemantics1BoxedString
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedList +data class NestedAnyofToCheckValidationSemantics1BoxedList
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedMap +data class NestedAnyofToCheckValidationSemantics1BoxedMap
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1 +class NestedAnyofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema01::class.java](#schema01)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedItems.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedItems.md new file mode 100644 index 00000000000..f609bc5ec46 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedItems.md @@ -0,0 +1,492 @@ +# NestedItems +org.openapijsonschematools.client.components.schemas.NestedItems.java +class NestedItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [NestedItems.NestedItems1Boxed](#nesteditems1boxed)
sealed interface for validated payloads | +| record | [NestedItems.NestedItems1BoxedList](#nesteditems1boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.NestedItems1](#nesteditems1)
schema class | +| static class | [NestedItems.NestedItemsListBuilder](#nesteditemslistbuilder)
builder for List payloads | +| static class | [NestedItems.NestedItemsList](#nesteditemslist)
output class for List payloads | +| sealed interface | [NestedItems.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [NestedItems.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items](#items)
schema class | +| static class | [NestedItems.ItemsListBuilder2](#itemslistbuilder2)
builder for List payloads | +| static class | [NestedItems.ItemsList2](#itemslist2)
output class for List payloads | +| sealed interface | [NestedItems.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items1BoxedList](#items1boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items1](#items1)
schema class | +| static class | [NestedItems.ItemsListBuilder1](#itemslistbuilder1)
builder for List payloads | +| static class | [NestedItems.ItemsList1](#itemslist1)
output class for List payloads | +| sealed interface | [NestedItems.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items2BoxedList](#items2boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items2](#items2)
schema class | +| static class | [NestedItems.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | +| static class | [NestedItems.ItemsList](#itemslist)
output class for List payloads | +| sealed interface | [NestedItems.Items3Boxed](#items3boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items3BoxedNumber](#items3boxednumber)
boxed class to store validated Number payloads | +| static class | [NestedItems.Items3](#items3)
schema class | + +## NestedItems1Boxed +sealed interface NestedItems1Boxed
+permits
+[NestedItems1BoxedList](#nesteditems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## NestedItems1BoxedList +data class NestedItems1BoxedList
+implements [NestedItems1Boxed](#nesteditems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItems1BoxedList([NestedItemsList](#nesteditemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedItems1 +class NestedItems1
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.NestedItemsList validatedPayload = + NestedItems.NestedItems1.validate( + new NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | validate(arg: [List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1BoxedList](#nesteditems1boxedlist) | validateAndBox([List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1Boxed](#nesteditems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NestedItemsListBuilder +class NestedItemsListBuilder
+builder for `List>>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItemsListBuilder()
Creates an empty list | +| NestedItemsListBuilder(List>>> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| NestedItemsListBuilder | add(item: List>>) | +| List>>> | build()
Returns list input that should be used with Schema.validate | + +## NestedItemsList +class NestedItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NestedItemsList](#nesteditemslist) | of([List>>>](#nesteditemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedList](#itemsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedList +data class ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList([ItemsList2](#itemslist2) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList2 validatedPayload = + NestedItems.Items.validate( + new NestedItems.ItemsListBuilder2() + .add( + listOf( + listOf( + 1 + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items1::class.java](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | validate(arg: [List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox([List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder2 +class ItemsListBuilder2
+builder for `List>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder2()
Creates an empty list | +| ItemsListBuilder2(List>> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder2 | add(item: List>) | +| List>> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList2 +class ItemsList2
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList2](#itemslist2) | of([List>>](#itemslistbuilder2) arg, SchemaConfiguration configuration) | + +## Items1Boxed +sealed interface Items1Boxed
+permits
+[Items1BoxedList](#items1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedList +data class Items1BoxedList
+implements [Items1Boxed](#items1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedList([ItemsList1](#itemslist1) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items1 +class Items1
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList1 validatedPayload = + NestedItems.Items1.validate( + new NestedItems.ItemsListBuilder1() + .add( + listOf( + 1 + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items2::class.java](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | validate(arg: [List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1BoxedList](#items1boxedlist) | validateAndBox([List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1Boxed](#items1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder1 +class ItemsListBuilder1
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder1()
Creates an empty list | +| ItemsListBuilder1(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder1 | add(item: List) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList1 +class ItemsList1
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList1](#itemslist1) | of([List>](#itemslistbuilder1) arg, SchemaConfiguration configuration) | + +## Items2Boxed +sealed interface Items2Boxed
+permits
+[Items2BoxedList](#items2boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedList +data class Items2BoxedList
+implements [Items2Boxed](#items2boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items2 +class Items2
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList validatedPayload = + NestedItems.Items2.validate( + new NestedItems.ItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items3::class.java](#items3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | validate(arg: [List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2BoxedList](#items2boxedlist) | validateAndBox([List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2Boxed](#items2boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder +class ItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder()
Creates an empty list | +| ItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder | add(item: Int) | +| ItemsListBuilder | add(item: Float) | +| ItemsListBuilder | add(item: Long) | +| ItemsListBuilder | add(item: Double) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsList +class ItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | + +## Items3Boxed +sealed interface Items3Boxed
+permits
+[Items3BoxedNumber](#items3boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Items3BoxedNumber +data class Items3BoxedNumber
+implements [Items3Boxed](#items3boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items3BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Items3 +class Items3
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md new file mode 100644 index 00000000000..6e78e1ba783 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedOneofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedOneofToCheckValidationSemantics.java +class NestedOneofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](#nestedoneoftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedOneofToCheckValidationSemantics1Boxed +sealed interface NestedOneofToCheckValidationSemantics1Boxed
+permits
+[NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid), +[NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean), +[NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber), +[NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring), +[NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist), +[NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedOneofToCheckValidationSemantics1BoxedVoid +data class NestedOneofToCheckValidationSemantics1BoxedVoid
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedBoolean +data class NestedOneofToCheckValidationSemantics1BoxedBoolean
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedNumber +data class NestedOneofToCheckValidationSemantics1BoxedNumber
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedString +data class NestedOneofToCheckValidationSemantics1BoxedString
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedList +data class NestedOneofToCheckValidationSemantics1BoxedList
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedMap +data class NestedOneofToCheckValidationSemantics1BoxedMap
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1 +class NestedOneofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema01::class.java](#schema01)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Not.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Not.md new file mode 100644 index 00000000000..4e1250b94c4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Not.md @@ -0,0 +1,207 @@ +# Not +org.openapijsonschematools.client.components.schemas.Not.java +class Not
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Not.Not1Boxed](#not1boxed)
sealed interface for validated payloads | +| record | [Not.Not1BoxedVoid](#not1boxedvoid)
boxed class to store validated null payloads | +| record | [Not.Not1BoxedBoolean](#not1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Not.Not1BoxedNumber](#not1boxednumber)
boxed class to store validated Number payloads | +| record | [Not.Not1BoxedString](#not1boxedstring)
boxed class to store validated String payloads | +| record | [Not.Not1BoxedList](#not1boxedlist)
boxed class to store validated List payloads | +| record | [Not.Not1BoxedMap](#not1boxedmap)
boxed class to store validated Map payloads | +| static class | [Not.Not1](#not1)
schema class | +| sealed interface | [Not.Not2Boxed](#not2boxed)
sealed interface for validated payloads | +| record | [Not.Not2BoxedNumber](#not2boxednumber)
boxed class to store validated Number payloads | +| static class | [Not.Not2](#not2)
schema class | + +## Not1Boxed +sealed interface Not1Boxed
+permits
+[Not1BoxedVoid](#not1boxedvoid), +[Not1BoxedBoolean](#not1boxedboolean), +[Not1BoxedNumber](#not1boxednumber), +[Not1BoxedString](#not1boxedstring), +[Not1BoxedList](#not1boxedlist), +[Not1BoxedMap](#not1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Not1BoxedVoid +data class Not1BoxedVoid
+implements [Not1Boxed](#not1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedBoolean +data class Not1BoxedBoolean
+implements [Not1Boxed](#not1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedNumber +data class Not1BoxedNumber
+implements [Not1Boxed](#not1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedString +data class Not1BoxedString
+implements [Not1Boxed](#not1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedList +data class Not1BoxedList
+implements [Not1Boxed](#not1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedMap +data class Not1BoxedMap
+implements [Not1Boxed](#not1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1 +class Not1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not2::class.java](#not2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Not1BoxedString](#not1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Not1BoxedVoid](#not1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Not1BoxedNumber](#not1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Not1BoxedBoolean](#not1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Not1BoxedMap](#not1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Not1BoxedList](#not1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Not1Boxed](#not1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Not2Boxed +sealed interface Not2Boxed
+permits
+[Not2BoxedNumber](#not2boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Not2BoxedNumber +data class Not2BoxedNumber
+implements [Not2Boxed](#not2boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Not2 +class Not2
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md new file mode 100644 index 00000000000..2578fcfd7c1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md @@ -0,0 +1,324 @@ +# NotMoreComplexSchema +org.openapijsonschematools.client.components.schemas.NotMoreComplexSchema.java +class NotMoreComplexSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [NotMoreComplexSchema.NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid)
boxed class to store validated null payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber)
boxed class to store validated Number payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring)
boxed class to store validated String payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist)
boxed class to store validated List payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.NotMoreComplexSchema1](#notmorecomplexschema1)
schema class | +| sealed interface | [NotMoreComplexSchema.NotBoxed](#notboxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotBoxedMap](#notboxedmap)
boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.Not](#not)
schema class | +| static class | [NotMoreComplexSchema.NotMapBuilder](#notmapbuilder)
builder for Map payloads | +| static class | [NotMoreComplexSchema.NotMap](#notmap)
output class for Map payloads | +| sealed interface | [NotMoreComplexSchema.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [NotMoreComplexSchema.Foo](#foo)
schema class | + +## NotMoreComplexSchema1Boxed +sealed interface NotMoreComplexSchema1Boxed
+permits
+[NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid), +[NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean), +[NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber), +[NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring), +[NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist), +[NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotMoreComplexSchema1BoxedVoid +data class NotMoreComplexSchema1BoxedVoid
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedBoolean +data class NotMoreComplexSchema1BoxedBoolean
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedNumber +data class NotMoreComplexSchema1BoxedNumber
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedString +data class NotMoreComplexSchema1BoxedString
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedList +data class NotMoreComplexSchema1BoxedList
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedMap +data class NotMoreComplexSchema1BoxedMap
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1 +class NotMoreComplexSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
+permits
+[NotBoxedMap](#notboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedMap +data class NotBoxedMap
+implements [NotBoxed](#notboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedMap([NotMap](#notmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## Not +class Not
+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.NotMoreComplexSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NotMoreComplexSchema.NotMap validatedPayload = + NotMoreComplexSchema.Not.validate( + new NotMoreComplexSchema.NotMapBuilder() + .foo("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | validate(arg: [Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxedMap](#notboxedmap) | validateAndBox([Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxed](#notboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotMapBuilder +class NotMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [NotMapBuilder](#notmapbuilder) | foo(value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Int) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Float) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Long) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Double) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: List) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Map) | + +## NotMap +class NotMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NotMap](#notmap) | of([Map](#notmapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md new file mode 100644 index 00000000000..3fa79cb0018 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md @@ -0,0 +1,98 @@ +# NulCharactersInStrings +org.openapijsonschematools.client.components.schemas.NulCharactersInStrings.java +class NulCharactersInStrings
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NulCharactersInStrings.NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed)
sealed interface for validated payloads | +| record | [NulCharactersInStrings.NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring)
boxed class to store validated String payloads | +| static class | [NulCharactersInStrings.NulCharactersInStrings1](#nulcharactersinstrings1)
schema class | +| enum | [NulCharactersInStrings.StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums)
String enum | + +## NulCharactersInStrings1Boxed +sealed interface NulCharactersInStrings1Boxed
+permits
+[NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NulCharactersInStrings1BoxedString +data class NulCharactersInStrings1BoxedString
+implements [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NulCharactersInStrings1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NulCharactersInStrings1 +class NulCharactersInStrings1
+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.NulCharactersInStrings; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = NulCharactersInStrings.NulCharactersInStrings1.validate( + "hello\u0000there", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "hello\u0000there"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums), configuration: SchemaConfiguration) | +| [NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringNulCharactersInStringsEnums +public enum StringNulCharactersInStringsEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| HELLO_NULL_THERE | value = "hello\u0000there" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md new file mode 100644 index 00000000000..0bcdf2e30e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md @@ -0,0 +1,52 @@ +# NullTypeMatchesOnlyTheNullObject +org.openapijsonschematools.client.components.schemas.NullTypeMatchesOnlyTheNullObject.java +class NullTypeMatchesOnlyTheNullObject
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed)
sealed interface for validated payloads | +| record | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid)
boxed class to store validated null payloads | +| static class | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](#nulltypematchesonlythenullobject1)
schema class | + +## NullTypeMatchesOnlyTheNullObject1Boxed +sealed interface NullTypeMatchesOnlyTheNullObject1Boxed
+permits
+[NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## NullTypeMatchesOnlyTheNullObject1BoxedVoid +data class NullTypeMatchesOnlyTheNullObject1BoxedVoid
+implements [NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullTypeMatchesOnlyTheNullObject1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NullTypeMatchesOnlyTheNullObject1 +class NullTypeMatchesOnlyTheNullObject1
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md new file mode 100644 index 00000000000..02a48980434 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md @@ -0,0 +1,52 @@ +# NumberTypeMatchesNumbers +org.openapijsonschematools.client.components.schemas.NumberTypeMatchesNumbers.java +class NumberTypeMatchesNumbers
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed)
sealed interface for validated payloads | +| record | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber)
boxed class to store validated Number payloads | +| static class | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](#numbertypematchesnumbers1)
schema class | + +## NumberTypeMatchesNumbers1Boxed +sealed interface NumberTypeMatchesNumbers1Boxed
+permits
+[NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberTypeMatchesNumbers1BoxedNumber +data class NumberTypeMatchesNumbers1BoxedNumber
+implements [NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberTypeMatchesNumbers1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NumberTypeMatchesNumbers1 +class NumberTypeMatchesNumbers1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md new file mode 100644 index 00000000000..a80a93be1e8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md @@ -0,0 +1,293 @@ +# ObjectPropertiesValidation +org.openapijsonschematools.client.components.schemas.ObjectPropertiesValidation.java +class ObjectPropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ObjectPropertiesValidation.ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidation1](#objectpropertiesvalidation1)
schema class | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder)
builder for Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMap](#objectpropertiesvalidationmap)
output class for Map payloads | +| sealed interface | [ObjectPropertiesValidation.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectPropertiesValidation.Bar](#bar)
schema class | +| sealed interface | [ObjectPropertiesValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| static class | [ObjectPropertiesValidation.Foo](#foo)
schema class | + +## ObjectPropertiesValidation1Boxed +sealed interface ObjectPropertiesValidation1Boxed
+permits
+[ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid), +[ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean), +[ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber), +[ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring), +[ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist), +[ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectPropertiesValidation1BoxedVoid +data class ObjectPropertiesValidation1BoxedVoid
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedBoolean +data class ObjectPropertiesValidation1BoxedBoolean
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedNumber +data class ObjectPropertiesValidation1BoxedNumber
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedString +data class ObjectPropertiesValidation1BoxedString
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedList +data class ObjectPropertiesValidation1BoxedList
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedMap +data class ObjectPropertiesValidation1BoxedMap
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedMap([ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1 +class ObjectPropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | validate(arg: [Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) | validateAndBox([Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ObjectPropertiesValidationMapBuilder +class ObjectPropertiesValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | bar(value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## ObjectPropertiesValidationMap +class ObjectPropertiesValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | of([Map](#objectpropertiesvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Number | foo()
[optional] | +| String | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedNumber](#fooboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md new file mode 100644 index 00000000000..ddc0d8b8aa6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md @@ -0,0 +1,52 @@ +# ObjectTypeMatchesObjects +org.openapijsonschematools.client.components.schemas.ObjectTypeMatchesObjects.java +class ObjectTypeMatchesObjects
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed)
sealed interface for validated payloads | +| record | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](#objecttypematchesobjects1)
schema class | + +## ObjectTypeMatchesObjects1Boxed +sealed interface ObjectTypeMatchesObjects1Boxed
+permits
+[ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectTypeMatchesObjects1BoxedMap +data class ObjectTypeMatchesObjects1BoxedMap
+implements [ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectTypeMatchesObjects1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectTypeMatchesObjects1 +class ObjectTypeMatchesObjects1
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Oneof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Oneof.md new file mode 100644 index 00000000000..c94e5017546 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/Oneof.md @@ -0,0 +1,362 @@ +# Oneof +org.openapijsonschematools.client.components.schemas.Oneof.java +class Oneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Oneof.Oneof1Boxed](#oneof1boxed)
sealed interface for validated payloads | +| record | [Oneof.Oneof1BoxedVoid](#oneof1boxedvoid)
boxed class to store validated null payloads | +| record | [Oneof.Oneof1BoxedBoolean](#oneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Oneof.Oneof1BoxedNumber](#oneof1boxednumber)
boxed class to store validated Number payloads | +| record | [Oneof.Oneof1BoxedString](#oneof1boxedstring)
boxed class to store validated String payloads | +| record | [Oneof.Oneof1BoxedList](#oneof1boxedlist)
boxed class to store validated List payloads | +| record | [Oneof.Oneof1BoxedMap](#oneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Oneof.Oneof1](#oneof1)
schema class | +| sealed interface | [Oneof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Oneof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Oneof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Oneof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Oneof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Oneof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Oneof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Oneof.Schema1](#schema1)
schema class | +| sealed interface | [Oneof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Oneof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [Oneof.Schema0](#schema0)
schema class | + +## Oneof1Boxed +sealed interface Oneof1Boxed
+permits
+[Oneof1BoxedVoid](#oneof1boxedvoid), +[Oneof1BoxedBoolean](#oneof1boxedboolean), +[Oneof1BoxedNumber](#oneof1boxednumber), +[Oneof1BoxedString](#oneof1boxedstring), +[Oneof1BoxedList](#oneof1boxedlist), +[Oneof1BoxedMap](#oneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Oneof1BoxedVoid +data class Oneof1BoxedVoid
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedBoolean +data class Oneof1BoxedBoolean
+implements [Oneof1Boxed](#oneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedNumber +data class Oneof1BoxedNumber
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedString +data class Oneof1BoxedString
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedList +data class Oneof1BoxedList
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedMap +data class Oneof1BoxedMap
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1 +class Oneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Oneof1BoxedString](#oneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Oneof1BoxedVoid](#oneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Oneof1BoxedNumber](#oneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Oneof1BoxedBoolean](#oneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Oneof1BoxedMap](#oneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Oneof1BoxedList](#oneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Oneof1Boxed](#oneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md new file mode 100644 index 00000000000..42bf6a2067a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md @@ -0,0 +1,674 @@ +# OneofComplexTypes +org.openapijsonschematools.client.components.schemas.OneofComplexTypes.java +class OneofComplexTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [OneofComplexTypes.OneofComplexTypes1Boxed](#oneofcomplextypes1boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.OneofComplexTypes1](#oneofcomplextypes1)
schema class | +| sealed interface | [OneofComplexTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema1](#schema1)
schema class | +| static class | [OneofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [OneofComplexTypes.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [OneofComplexTypes.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [OneofComplexTypes.Foo](#foo)
schema class | +| sealed interface | [OneofComplexTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema0](#schema0)
schema class | +| static class | [OneofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [OneofComplexTypes.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [OneofComplexTypes.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [OneofComplexTypes.Bar](#bar)
schema class | + +## OneofComplexTypes1Boxed +sealed interface OneofComplexTypes1Boxed
+permits
+[OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid), +[OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean), +[OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber), +[OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring), +[OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist), +[OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofComplexTypes1BoxedVoid +data class OneofComplexTypes1BoxedVoid
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedBoolean +data class OneofComplexTypes1BoxedBoolean
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedNumber +data class OneofComplexTypes1BoxedNumber
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedString +data class OneofComplexTypes1BoxedString
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedList +data class OneofComplexTypes1BoxedList
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedMap +data class OneofComplexTypes1BoxedMap
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1 +class OneofComplexTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md new file mode 100644 index 00000000000..ec2efa5bd7a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md @@ -0,0 +1,394 @@ +# OneofWithBaseSchema +org.openapijsonschematools.client.components.schemas.OneofWithBaseSchema.java +class OneofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithBaseSchema.OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| static class | [OneofWithBaseSchema.OneofWithBaseSchema1](#oneofwithbaseschema1)
schema class | +| sealed interface | [OneofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema1](#schema1)
schema class | +| sealed interface | [OneofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema0](#schema0)
schema class | + +## OneofWithBaseSchema1Boxed +sealed interface OneofWithBaseSchema1Boxed
+permits
+[OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithBaseSchema1BoxedString +data class OneofWithBaseSchema1BoxedString
+implements [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithBaseSchema1 +class OneofWithBaseSchema1
+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.OneofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = OneofWithBaseSchema.OneofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md new file mode 100644 index 00000000000..3c41a98cb37 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md @@ -0,0 +1,340 @@ +# OneofWithEmptySchema +org.openapijsonschematools.client.components.schemas.OneofWithEmptySchema.java +class OneofWithEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithEmptySchema.OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.OneofWithEmptySchema1](#oneofwithemptyschema1)
schema class | +| sealed interface | [OneofWithEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [OneofWithEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [OneofWithEmptySchema.Schema0](#schema0)
schema class | + +## OneofWithEmptySchema1Boxed +sealed interface OneofWithEmptySchema1Boxed
+permits
+[OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid), +[OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean), +[OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber), +[OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring), +[OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist), +[OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithEmptySchema1BoxedVoid +data class OneofWithEmptySchema1BoxedVoid
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedBoolean +data class OneofWithEmptySchema1BoxedBoolean
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedNumber +data class OneofWithEmptySchema1BoxedNumber
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedString +data class OneofWithEmptySchema1BoxedString
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedList +data class OneofWithEmptySchema1BoxedList
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedMap +data class OneofWithEmptySchema1BoxedMap
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1 +class OneofWithEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md new file mode 100644 index 00000000000..5fb44f316d2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md @@ -0,0 +1,617 @@ +# OneofWithRequired +org.openapijsonschematools.client.components.schemas.OneofWithRequired.java +class OneofWithRequired
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [OneofWithRequired.OneofWithRequired1Boxed](#oneofwithrequired1boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.OneofWithRequired1](#oneofwithrequired1)
schema class | +| sealed interface | [OneofWithRequired.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema1](#schema1)
schema class | +| static class | [OneofWithRequired.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [OneofWithRequired.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [OneofWithRequired.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema0](#schema0)
schema class | +| static class | [OneofWithRequired.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [OneofWithRequired.Schema0Map](#schema0map)
output class for Map payloads | + +## OneofWithRequired1Boxed +sealed interface OneofWithRequired1Boxed
+permits
+[OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithRequired1BoxedMap +data class OneofWithRequired1BoxedMap
+implements [OneofWithRequired1Boxed](#oneofwithrequired1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithRequired1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithRequired1 +class OneofWithRequired1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1Boxed](#oneofwithrequired1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "baz",
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map00Builder +class Schema1Map00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map00Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: String) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: List) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Map) | + +## Schema1Map01Builder +class Schema1Map01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Map) | + +## Schema1Map10Builder +class Schema1Map10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Nothing?) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Boolean) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: String) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Int) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Float) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Long) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Double) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: List) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Map) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Nothing?) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Boolean) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: String) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Int) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Float) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Long) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Double) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: List) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Map) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | baz()
| +| Any? | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "bar",
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map00Builder +class Schema0Map00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map00Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: String) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: List) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Map) | + +## Schema0Map01Builder +class Schema0Map01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Map) | + +## Schema0Map10Builder +class Schema0Map10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Nothing?) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Boolean) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: String) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Int) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Float) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Long) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Double) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: List) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Map) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Nothing?) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Boolean) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: String) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Int) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Float) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Long) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Double) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: List) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Map) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | bar()
| +| Any? | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md new file mode 100644 index 00000000000..db50b22bddc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md @@ -0,0 +1,169 @@ +# PatternIsNotAnchored +org.openapijsonschematools.client.components.schemas.PatternIsNotAnchored.java +class PatternIsNotAnchored
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternIsNotAnchored.PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed)
sealed interface for validated payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring)
boxed class to store validated String payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist)
boxed class to store validated List payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternIsNotAnchored.PatternIsNotAnchored1](#patternisnotanchored1)
schema class | + +## PatternIsNotAnchored1Boxed +sealed interface PatternIsNotAnchored1Boxed
+permits
+[PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid), +[PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean), +[PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber), +[PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring), +[PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist), +[PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternIsNotAnchored1BoxedVoid +data class PatternIsNotAnchored1BoxedVoid
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedBoolean +data class PatternIsNotAnchored1BoxedBoolean
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedNumber +data class PatternIsNotAnchored1BoxedNumber
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedString +data class PatternIsNotAnchored1BoxedString
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedList +data class PatternIsNotAnchored1BoxedList
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedMap +data class PatternIsNotAnchored1BoxedMap
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1 +class PatternIsNotAnchored1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
    "a+"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternValidation.md new file mode 100644 index 00000000000..38aabdd0f51 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PatternValidation.md @@ -0,0 +1,169 @@ +# PatternValidation +org.openapijsonschematools.client.components.schemas.PatternValidation.java +class PatternValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternValidation.PatternValidation1Boxed](#patternvalidation1boxed)
sealed interface for validated payloads | +| record | [PatternValidation.PatternValidation1BoxedVoid](#patternvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternValidation.PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternValidation.PatternValidation1BoxedNumber](#patternvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternValidation.PatternValidation1BoxedString](#patternvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [PatternValidation.PatternValidation1BoxedList](#patternvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [PatternValidation.PatternValidation1BoxedMap](#patternvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternValidation.PatternValidation1](#patternvalidation1)
schema class | + +## PatternValidation1Boxed +sealed interface PatternValidation1Boxed
+permits
+[PatternValidation1BoxedVoid](#patternvalidation1boxedvoid), +[PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean), +[PatternValidation1BoxedNumber](#patternvalidation1boxednumber), +[PatternValidation1BoxedString](#patternvalidation1boxedstring), +[PatternValidation1BoxedList](#patternvalidation1boxedlist), +[PatternValidation1BoxedMap](#patternvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternValidation1BoxedVoid +data class PatternValidation1BoxedVoid
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedBoolean +data class PatternValidation1BoxedBoolean
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedNumber +data class PatternValidation1BoxedNumber
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedString +data class PatternValidation1BoxedString
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedList +data class PatternValidation1BoxedList
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedMap +data class PatternValidation1BoxedMap
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1 +class PatternValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
    "^a*\$"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedString](#patternvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedVoid](#patternvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedNumber](#patternvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedMap](#patternvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedList](#patternvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1Boxed](#patternvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md new file mode 100644 index 00000000000..385cc3ca185 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md @@ -0,0 +1,463 @@ +# PropertiesWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.PropertiesWithEscapedCharacters.java +class PropertiesWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist)
boxed class to store validated List payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](#propertieswithescapedcharacters1)
schema class | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder)
builder for Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap)
output class for Map payloads | +| sealed interface | [PropertiesWithEscapedCharacters.Foou000CbarBoxed](#foou000cbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foou000CbarBoxedNumber](#foou000cbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foou000Cbar](#foou000cbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FootbarBoxed](#footbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FootbarBoxedNumber](#footbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Footbar](#footbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoorbarBoxed](#foorbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoorbarBoxedNumber](#foorbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foorbar](#foorbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.Foobar1Boxed](#foobar1boxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foobar1BoxedNumber](#foobar1boxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar1](#foobar1)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoobarBoxed](#foobarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoobarBoxedNumber](#foobarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar](#foobar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoonbarBoxed](#foonbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoonbarBoxedNumber](#foonbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foonbar](#foonbar)
schema class | + +## PropertiesWithEscapedCharacters1Boxed +sealed interface PropertiesWithEscapedCharacters1Boxed
+permits
+[PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid), +[PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean), +[PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber), +[PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring), +[PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist), +[PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWithEscapedCharacters1BoxedVoid +data class PropertiesWithEscapedCharacters1BoxedVoid
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedBoolean +data class PropertiesWithEscapedCharacters1BoxedBoolean
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedNumber +data class PropertiesWithEscapedCharacters1BoxedNumber
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedString +data class PropertiesWithEscapedCharacters1BoxedString
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedList +data class PropertiesWithEscapedCharacters1BoxedList
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedMap +data class PropertiesWithEscapedCharacters1BoxedMap
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedMap([PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1 +class PropertiesWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo\nbar" to [Foonbar::class.java](#foonbar)),
    "foo\"bar" to [Foobar::class.java](#foobar)),
    "foo\\bar" to [Foobar1::class.java](#foobar1)),
    "foo\rbar" to [Foorbar::class.java](#foorbar)),
    "foo\tbar" to [Footbar::class.java](#footbar)),
    "foo\u000Cbar" to [Foou000Cbar::class.java](#foou000cbar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | validate(arg: [Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWithEscapedCharactersMapBuilder +class PropertiesWithEscapedCharactersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharactersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWithEscapedCharactersMap +class PropertiesWithEscapedCharactersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | of([Map](#propertieswithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["foo\nbar"], instance["foo\"bar"], instance["foo\\bar"], instance["foo\rbar"], instance["foo\tbar"], instance["foo\u000Cbar"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Foou000CbarBoxed +sealed interface Foou000CbarBoxed
+permits
+[Foou000CbarBoxedNumber](#foou000cbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foou000CbarBoxedNumber +data class Foou000CbarBoxedNumber
+implements [Foou000CbarBoxed](#foou000cbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foou000CbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foou000Cbar +class Foou000Cbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FootbarBoxed +sealed interface FootbarBoxed
+permits
+[FootbarBoxedNumber](#footbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FootbarBoxedNumber +data class FootbarBoxedNumber
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Footbar +class Footbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoorbarBoxed +sealed interface FoorbarBoxed
+permits
+[FoorbarBoxedNumber](#foorbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoorbarBoxedNumber +data class FoorbarBoxedNumber
+implements [FoorbarBoxed](#foorbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoorbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foorbar +class Foorbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Foobar1Boxed +sealed interface Foobar1Boxed
+permits
+[Foobar1BoxedNumber](#foobar1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foobar1BoxedNumber +data class Foobar1BoxedNumber
+implements [Foobar1Boxed](#foobar1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foobar1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foobar1 +class Foobar1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoobarBoxed +sealed interface FoobarBoxed
+permits
+[FoobarBoxedNumber](#foobarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoobarBoxedNumber +data class FoobarBoxedNumber
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foobar +class Foobar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoonbarBoxed +sealed interface FoonbarBoxed
+permits
+[FoonbarBoxedNumber](#foonbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoonbarBoxedNumber +data class FoonbarBoxedNumber
+implements [FoonbarBoxed](#foonbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoonbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foonbar +class Foonbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md new file mode 100644 index 00000000000..9a3d24c717a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md @@ -0,0 +1,250 @@ +# PropertyNamedRefThatIsNotAReference +org.openapijsonschematools.client.components.schemas.PropertyNamedRefThatIsNotAReference.java +class PropertyNamedRefThatIsNotAReference
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed)
sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring)
boxed class to store validated String payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist)
boxed class to store validated List payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](#propertynamedrefthatisnotareference1)
schema class | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder)
builder for Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap)
output class for Map payloads | +| sealed interface | [PropertyNamedRefThatIsNotAReference.RefBoxed](#refboxed)
sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.RefBoxedString](#refboxedstring)
boxed class to store validated String payloads | +| static class | [PropertyNamedRefThatIsNotAReference.Ref](#ref)
schema class | + +## PropertyNamedRefThatIsNotAReference1Boxed +sealed interface PropertyNamedRefThatIsNotAReference1Boxed
+permits
+[PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid), +[PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean), +[PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber), +[PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring), +[PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist), +[PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamedRefThatIsNotAReference1BoxedVoid +data class PropertyNamedRefThatIsNotAReference1BoxedVoid
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedBoolean +data class PropertyNamedRefThatIsNotAReference1BoxedBoolean
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedNumber +data class PropertyNamedRefThatIsNotAReference1BoxedNumber
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedString +data class PropertyNamedRefThatIsNotAReference1BoxedString
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedList +data class PropertyNamedRefThatIsNotAReference1BoxedList
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedMap +data class PropertyNamedRefThatIsNotAReference1BoxedMap
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedMap([PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1 +class PropertyNamedRefThatIsNotAReference1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "\$ref" to [Ref::class.java](#ref))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | validate(arg: [Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) | validateAndBox([Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertyNamedRefThatIsNotAReferenceMapBuilder +class PropertyNamedRefThatIsNotAReferenceMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReferenceMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | reverseSolidusDollarSignRef(value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: List) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertyNamedRefThatIsNotAReferenceMap +class PropertyNamedRefThatIsNotAReferenceMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | of([Map](#propertynamedrefthatisnotareferencemapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["\$ref"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## RefBoxed +sealed interface RefBoxed
+permits
+[RefBoxedString](#refboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## RefBoxedString +data class RefBoxedString
+implements [RefBoxed](#refboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ref +class Ref
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAdditionalproperties.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAdditionalproperties.md new file mode 100644 index 00000000000..bbb9fea7c84 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAdditionalproperties.md @@ -0,0 +1,127 @@ +# RefInAdditionalproperties +org.openapijsonschematools.client.components.schemas.RefInAdditionalproperties.java +class RefInAdditionalproperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RefInAdditionalproperties.RefInAdditionalproperties1Boxed](#refinadditionalproperties1boxed)
sealed interface for validated payloads | +| record | [RefInAdditionalproperties.RefInAdditionalproperties1BoxedMap](#refinadditionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInAdditionalproperties.RefInAdditionalproperties1](#refinadditionalproperties1)
schema class | +| static class | [RefInAdditionalproperties.RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder)
builder for Map payloads | +| static class | [RefInAdditionalproperties.RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap)
output class for Map payloads | + +## RefInAdditionalproperties1Boxed +sealed interface RefInAdditionalproperties1Boxed
+permits
+[RefInAdditionalproperties1BoxedMap](#refinadditionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInAdditionalproperties1BoxedMap +data class RefInAdditionalproperties1BoxedMap
+implements [RefInAdditionalproperties1Boxed](#refinadditionalproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAdditionalproperties1BoxedMap([RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAdditionalproperties1 +class RefInAdditionalproperties1
+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.RefInAdditionalproperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +RefInAdditionalproperties.RefInAdditionalpropertiesMap validatedPayload = + RefInAdditionalproperties.RefInAdditionalproperties1.validate( + new RefInAdditionalproperties.RefInAdditionalpropertiesMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) | validate(arg: [Map<?, ?>](#refinadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [RefInAdditionalproperties1BoxedMap](#refinadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#refinadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [RefInAdditionalproperties1Boxed](#refinadditionalproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RefInAdditionalpropertiesMapBuilder +class RefInAdditionalpropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAdditionalpropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: String) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Int) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Float) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Long) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Double) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: List) | +| [RefInAdditionalpropertiesMapBuilder](#refinadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Map) | + +## RefInAdditionalpropertiesMap +class RefInAdditionalpropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RefInAdditionalpropertiesMap](#refinadditionalpropertiesmap) | of([Map](#refinadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAllof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAllof.md new file mode 100644 index 00000000000..7342790e9f3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAllof.md @@ -0,0 +1,169 @@ +# RefInAllof +org.openapijsonschematools.client.components.schemas.RefInAllof.java +class RefInAllof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInAllof.RefInAllof1Boxed](#refinallof1boxed)
sealed interface for validated payloads | +| record | [RefInAllof.RefInAllof1BoxedVoid](#refinallof1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInAllof.RefInAllof1BoxedBoolean](#refinallof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInAllof.RefInAllof1BoxedNumber](#refinallof1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInAllof.RefInAllof1BoxedString](#refinallof1boxedstring)
boxed class to store validated String payloads | +| record | [RefInAllof.RefInAllof1BoxedList](#refinallof1boxedlist)
boxed class to store validated List payloads | +| record | [RefInAllof.RefInAllof1BoxedMap](#refinallof1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInAllof.RefInAllof1](#refinallof1)
schema class | + +## RefInAllof1Boxed +sealed interface RefInAllof1Boxed
+permits
+[RefInAllof1BoxedVoid](#refinallof1boxedvoid), +[RefInAllof1BoxedBoolean](#refinallof1boxedboolean), +[RefInAllof1BoxedNumber](#refinallof1boxednumber), +[RefInAllof1BoxedString](#refinallof1boxedstring), +[RefInAllof1BoxedList](#refinallof1boxedlist), +[RefInAllof1BoxedMap](#refinallof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInAllof1BoxedVoid +data class RefInAllof1BoxedVoid
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedBoolean +data class RefInAllof1BoxedBoolean
+implements [RefInAllof1Boxed](#refinallof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedNumber +data class RefInAllof1BoxedNumber
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedString +data class RefInAllof1BoxedString
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedList +data class RefInAllof1BoxedList
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1BoxedMap +data class RefInAllof1BoxedMap
+implements [RefInAllof1Boxed](#refinallof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAllof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAllof1 +class RefInAllof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedString](#refinallof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedVoid](#refinallof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedNumber](#refinallof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedBoolean](#refinallof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedMap](#refinallof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInAllof1BoxedList](#refinallof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInAllof1Boxed](#refinallof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAnyof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAnyof.md new file mode 100644 index 00000000000..f7b064e8afc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInAnyof.md @@ -0,0 +1,169 @@ +# RefInAnyof +org.openapijsonschematools.client.components.schemas.RefInAnyof.java +class RefInAnyof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInAnyof.RefInAnyof1Boxed](#refinanyof1boxed)
sealed interface for validated payloads | +| record | [RefInAnyof.RefInAnyof1BoxedVoid](#refinanyof1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInAnyof.RefInAnyof1BoxedBoolean](#refinanyof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInAnyof.RefInAnyof1BoxedNumber](#refinanyof1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInAnyof.RefInAnyof1BoxedString](#refinanyof1boxedstring)
boxed class to store validated String payloads | +| record | [RefInAnyof.RefInAnyof1BoxedList](#refinanyof1boxedlist)
boxed class to store validated List payloads | +| record | [RefInAnyof.RefInAnyof1BoxedMap](#refinanyof1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInAnyof.RefInAnyof1](#refinanyof1)
schema class | + +## RefInAnyof1Boxed +sealed interface RefInAnyof1Boxed
+permits
+[RefInAnyof1BoxedVoid](#refinanyof1boxedvoid), +[RefInAnyof1BoxedBoolean](#refinanyof1boxedboolean), +[RefInAnyof1BoxedNumber](#refinanyof1boxednumber), +[RefInAnyof1BoxedString](#refinanyof1boxedstring), +[RefInAnyof1BoxedList](#refinanyof1boxedlist), +[RefInAnyof1BoxedMap](#refinanyof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInAnyof1BoxedVoid +data class RefInAnyof1BoxedVoid
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedBoolean +data class RefInAnyof1BoxedBoolean
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedNumber +data class RefInAnyof1BoxedNumber
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedString +data class RefInAnyof1BoxedString
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedList +data class RefInAnyof1BoxedList
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1BoxedMap +data class RefInAnyof1BoxedMap
+implements [RefInAnyof1Boxed](#refinanyof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInAnyof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInAnyof1 +class RefInAnyof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedString](#refinanyof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedVoid](#refinanyof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedNumber](#refinanyof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedBoolean](#refinanyof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedMap](#refinanyof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInAnyof1BoxedList](#refinanyof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInAnyof1Boxed](#refinanyof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInItems.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInItems.md new file mode 100644 index 00000000000..713b342f973 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInItems.md @@ -0,0 +1,127 @@ +# RefInItems +org.openapijsonschematools.client.components.schemas.RefInItems.java +class RefInItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RefInItems.RefInItems1Boxed](#refinitems1boxed)
sealed interface for validated payloads | +| record | [RefInItems.RefInItems1BoxedList](#refinitems1boxedlist)
boxed class to store validated List payloads | +| static class | [RefInItems.RefInItems1](#refinitems1)
schema class | +| static class | [RefInItems.RefInItemsListBuilder](#refinitemslistbuilder)
builder for List payloads | +| static class | [RefInItems.RefInItemsList](#refinitemslist)
output class for List payloads | + +## RefInItems1Boxed +sealed interface RefInItems1Boxed
+permits
+[RefInItems1BoxedList](#refinitems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## RefInItems1BoxedList +data class RefInItems1BoxedList
+implements [RefInItems1Boxed](#refinitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInItems1BoxedList([RefInItemsList](#refinitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInItemsList](#refinitemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInItems1 +class RefInItems1
+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.RefInItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +RefInItems.RefInItemsList validatedPayload = + RefInItems.RefInItems1.validate( + new RefInItems.RefInItemsListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInItemsList](#refinitemslist) | validate(arg: [List<*>](#refinitemslistbuilder), configuration: SchemaConfiguration) | +| [RefInItems1BoxedList](#refinitems1boxedlist) | validateAndBox([List<*>](#refinitemslistbuilder), configuration: SchemaConfiguration) | +| [RefInItems1Boxed](#refinitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RefInItemsListBuilder +class RefInItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInItemsListBuilder()
Creates an empty list | +| RefInItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| RefInItemsListBuilder | add(item: Nothing?) | +| RefInItemsListBuilder | add(item: Boolean) | +| RefInItemsListBuilder | add(item: String) | +| RefInItemsListBuilder | add(item: Int) | +| RefInItemsListBuilder | add(item: Float) | +| RefInItemsListBuilder | add(item: Long) | +| RefInItemsListBuilder | add(item: Double) | +| RefInItemsListBuilder | add(item: List) | +| RefInItemsListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## RefInItemsList +class RefInItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RefInItemsList](#refinitemslist) | of([List](#refinitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInNot.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInNot.md new file mode 100644 index 00000000000..a7ff963604f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInNot.md @@ -0,0 +1,169 @@ +# RefInNot +org.openapijsonschematools.client.components.schemas.RefInNot.java +class RefInNot
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInNot.RefInNot1Boxed](#refinnot1boxed)
sealed interface for validated payloads | +| record | [RefInNot.RefInNot1BoxedVoid](#refinnot1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInNot.RefInNot1BoxedBoolean](#refinnot1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInNot.RefInNot1BoxedNumber](#refinnot1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInNot.RefInNot1BoxedString](#refinnot1boxedstring)
boxed class to store validated String payloads | +| record | [RefInNot.RefInNot1BoxedList](#refinnot1boxedlist)
boxed class to store validated List payloads | +| record | [RefInNot.RefInNot1BoxedMap](#refinnot1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInNot.RefInNot1](#refinnot1)
schema class | + +## RefInNot1Boxed +sealed interface RefInNot1Boxed
+permits
+[RefInNot1BoxedVoid](#refinnot1boxedvoid), +[RefInNot1BoxedBoolean](#refinnot1boxedboolean), +[RefInNot1BoxedNumber](#refinnot1boxednumber), +[RefInNot1BoxedString](#refinnot1boxedstring), +[RefInNot1BoxedList](#refinnot1boxedlist), +[RefInNot1BoxedMap](#refinnot1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInNot1BoxedVoid +data class RefInNot1BoxedVoid
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedBoolean +data class RefInNot1BoxedBoolean
+implements [RefInNot1Boxed](#refinnot1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedNumber +data class RefInNot1BoxedNumber
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedString +data class RefInNot1BoxedString
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedList +data class RefInNot1BoxedList
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1BoxedMap +data class RefInNot1BoxedMap
+implements [RefInNot1Boxed](#refinnot1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInNot1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInNot1 +class RefInNot1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInNot1BoxedString](#refinnot1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInNot1BoxedVoid](#refinnot1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInNot1BoxedNumber](#refinnot1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInNot1BoxedBoolean](#refinnot1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInNot1BoxedMap](#refinnot1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInNot1BoxedList](#refinnot1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInNot1Boxed](#refinnot1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInOneof.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInOneof.md new file mode 100644 index 00000000000..641ff36e8c5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInOneof.md @@ -0,0 +1,169 @@ +# RefInOneof +org.openapijsonschematools.client.components.schemas.RefInOneof.java +class RefInOneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RefInOneof.RefInOneof1Boxed](#refinoneof1boxed)
sealed interface for validated payloads | +| record | [RefInOneof.RefInOneof1BoxedVoid](#refinoneof1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInOneof.RefInOneof1BoxedBoolean](#refinoneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInOneof.RefInOneof1BoxedNumber](#refinoneof1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInOneof.RefInOneof1BoxedString](#refinoneof1boxedstring)
boxed class to store validated String payloads | +| record | [RefInOneof.RefInOneof1BoxedList](#refinoneof1boxedlist)
boxed class to store validated List payloads | +| record | [RefInOneof.RefInOneof1BoxedMap](#refinoneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInOneof.RefInOneof1](#refinoneof1)
schema class | + +## RefInOneof1Boxed +sealed interface RefInOneof1Boxed
+permits
+[RefInOneof1BoxedVoid](#refinoneof1boxedvoid), +[RefInOneof1BoxedBoolean](#refinoneof1boxedboolean), +[RefInOneof1BoxedNumber](#refinoneof1boxednumber), +[RefInOneof1BoxedString](#refinoneof1boxedstring), +[RefInOneof1BoxedList](#refinoneof1boxedlist), +[RefInOneof1BoxedMap](#refinoneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInOneof1BoxedVoid +data class RefInOneof1BoxedVoid
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedBoolean +data class RefInOneof1BoxedBoolean
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedNumber +data class RefInOneof1BoxedNumber
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedString +data class RefInOneof1BoxedString
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedList +data class RefInOneof1BoxedList
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1BoxedMap +data class RefInOneof1BoxedMap
+implements [RefInOneof1Boxed](#refinoneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInOneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInOneof1 +class RefInOneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedString](#refinoneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedVoid](#refinoneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedNumber](#refinoneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedBoolean](#refinoneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedMap](#refinoneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RefInOneof1BoxedList](#refinoneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInOneof1Boxed](#refinoneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInProperty.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInProperty.md new file mode 100644 index 00000000000..b7402792e0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RefInProperty.md @@ -0,0 +1,220 @@ +# RefInProperty +org.openapijsonschematools.client.components.schemas.RefInProperty.java +class RefInProperty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RefInProperty.RefInProperty1Boxed](#refinproperty1boxed)
sealed interface for validated payloads | +| record | [RefInProperty.RefInProperty1BoxedVoid](#refinproperty1boxedvoid)
boxed class to store validated null payloads | +| record | [RefInProperty.RefInProperty1BoxedBoolean](#refinproperty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RefInProperty.RefInProperty1BoxedNumber](#refinproperty1boxednumber)
boxed class to store validated Number payloads | +| record | [RefInProperty.RefInProperty1BoxedString](#refinproperty1boxedstring)
boxed class to store validated String payloads | +| record | [RefInProperty.RefInProperty1BoxedList](#refinproperty1boxedlist)
boxed class to store validated List payloads | +| record | [RefInProperty.RefInProperty1BoxedMap](#refinproperty1boxedmap)
boxed class to store validated Map payloads | +| static class | [RefInProperty.RefInProperty1](#refinproperty1)
schema class | +| static class | [RefInProperty.RefInPropertyMapBuilder](#refinpropertymapbuilder)
builder for Map payloads | +| static class | [RefInProperty.RefInPropertyMap](#refinpropertymap)
output class for Map payloads | + +## RefInProperty1Boxed +sealed interface RefInProperty1Boxed
+permits
+[RefInProperty1BoxedVoid](#refinproperty1boxedvoid), +[RefInProperty1BoxedBoolean](#refinproperty1boxedboolean), +[RefInProperty1BoxedNumber](#refinproperty1boxednumber), +[RefInProperty1BoxedString](#refinproperty1boxedstring), +[RefInProperty1BoxedList](#refinproperty1boxedlist), +[RefInProperty1BoxedMap](#refinproperty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RefInProperty1BoxedVoid +data class RefInProperty1BoxedVoid
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedBoolean +data class RefInProperty1BoxedBoolean
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedNumber +data class RefInProperty1BoxedNumber
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedString +data class RefInProperty1BoxedString
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedList +data class RefInProperty1BoxedList
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1BoxedMap +data class RefInProperty1BoxedMap
+implements [RefInProperty1Boxed](#refinproperty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInProperty1BoxedMap([RefInPropertyMap](#refinpropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RefInPropertyMap](#refinpropertymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RefInProperty1 +class RefInProperty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "a" to [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java](../../components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RefInPropertyMap](#refinpropertymap) | validate(arg: [Map<?, ?>](#refinpropertymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedString](#refinproperty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedVoid](#refinproperty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedNumber](#refinproperty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedBoolean](#refinproperty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RefInProperty1BoxedMap](#refinproperty1boxedmap) | validateAndBox([Map<?, ?>](#refinpropertymapbuilder), configuration: SchemaConfiguration) | +| [RefInProperty1BoxedList](#refinproperty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RefInProperty1Boxed](#refinproperty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RefInPropertyMapBuilder +class RefInPropertyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefInPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Nothing?) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Boolean) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: String) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Int) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Float) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Long) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Double) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: List) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | a(value: Map) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: String) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Int) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Float) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Long) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Double) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: List) | +| [RefInPropertyMapBuilder](#refinpropertymapbuilder) | additionalProperty(key: String, value: Map) | + +## RefInPropertyMap +class RefInPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RefInPropertyMap](#refinpropertymap) | of([Map](#refinpropertymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | a()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md new file mode 100644 index 00000000000..7b71ca0e3f6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md @@ -0,0 +1,353 @@ +# RequiredDefaultValidation +org.openapijsonschematools.client.components.schemas.RequiredDefaultValidation.java +class RequiredDefaultValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredDefaultValidation.RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed)
sealed interface for validated payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidation1](#requireddefaultvalidation1)
schema class | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder)
builder for Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMap](#requireddefaultvalidationmap)
output class for Map payloads | +| sealed interface | [RequiredDefaultValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredDefaultValidation.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.Foo](#foo)
schema class | + +## RequiredDefaultValidation1Boxed +sealed interface RequiredDefaultValidation1Boxed
+permits
+[RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid), +[RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean), +[RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber), +[RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring), +[RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist), +[RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredDefaultValidation1BoxedVoid +data class RequiredDefaultValidation1BoxedVoid
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedBoolean +data class RequiredDefaultValidation1BoxedBoolean
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedNumber +data class RequiredDefaultValidation1BoxedNumber
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedString +data class RequiredDefaultValidation1BoxedString
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedList +data class RequiredDefaultValidation1BoxedList
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedMap +data class RequiredDefaultValidation1BoxedMap
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedMap([RequiredDefaultValidationMap](#requireddefaultvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1 +class RequiredDefaultValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | validate(arg: [Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredDefaultValidationMapBuilder +class RequiredDefaultValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Map) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredDefaultValidationMap +class RequiredDefaultValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | of([Map](#requireddefaultvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredValidation.md new file mode 100644 index 00000000000..448abb465fe --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredValidation.md @@ -0,0 +1,512 @@ +# RequiredValidation +org.openapijsonschematools.client.components.schemas.RequiredValidation.java +class RequiredValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredValidation.RequiredValidation1Boxed](#requiredvalidation1boxed)
sealed interface for validated payloads | +| record | [RequiredValidation.RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.RequiredValidation1BoxedString](#requiredvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.RequiredValidation1BoxedList](#requiredvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.RequiredValidation1BoxedMap](#requiredvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.RequiredValidation1](#requiredvalidation1)
schema class | +| static class | [RequiredValidation.RequiredValidationMapBuilder](#requiredvalidationmapbuilder)
builder for Map payloads | +| static class | [RequiredValidation.RequiredValidationMap](#requiredvalidationmap)
output class for Map payloads | +| sealed interface | [RequiredValidation.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [RequiredValidation.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.Bar](#bar)
schema class | +| sealed interface | [RequiredValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredValidation.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.Foo](#foo)
schema class | + +## RequiredValidation1Boxed +sealed interface RequiredValidation1Boxed
+permits
+[RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid), +[RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean), +[RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber), +[RequiredValidation1BoxedString](#requiredvalidation1boxedstring), +[RequiredValidation1BoxedList](#requiredvalidation1boxedlist), +[RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredValidation1BoxedVoid +data class RequiredValidation1BoxedVoid
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedBoolean +data class RequiredValidation1BoxedBoolean
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedNumber +data class RequiredValidation1BoxedNumber
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedString +data class RequiredValidation1BoxedString
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedList +data class RequiredValidation1BoxedList
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedMap +data class RequiredValidation1BoxedMap
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedMap([RequiredValidationMap](#requiredvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap](#requiredvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1 +class RequiredValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredValidationMap](#requiredvalidationmap) | validate(arg: [Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedString](#requiredvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedList](#requiredvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1Boxed](#requiredvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredValidationMap0Builder +class RequiredValidationMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Map) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Map) | + +## RequiredValidationMapBuilder +class RequiredValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Map) | + +## RequiredValidationMap +class RequiredValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredValidationMap](#requiredvalidationmap) | of([Map](#requiredvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
| +| Any? | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md new file mode 100644 index 00000000000..85125a5f8d2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md @@ -0,0 +1,353 @@ +# RequiredWithEmptyArray +org.openapijsonschematools.client.components.schemas.RequiredWithEmptyArray.java +class RequiredWithEmptyArray
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredWithEmptyArray.RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed)
sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArray1](#requiredwithemptyarray1)
schema class | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder)
builder for Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMap](#requiredwithemptyarraymap)
output class for Map payloads | +| sealed interface | [RequiredWithEmptyArray.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.Foo](#foo)
schema class | + +## RequiredWithEmptyArray1Boxed +sealed interface RequiredWithEmptyArray1Boxed
+permits
+[RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid), +[RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean), +[RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber), +[RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring), +[RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist), +[RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEmptyArray1BoxedVoid +data class RequiredWithEmptyArray1BoxedVoid
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedBoolean +data class RequiredWithEmptyArray1BoxedBoolean
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedNumber +data class RequiredWithEmptyArray1BoxedNumber
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedString +data class RequiredWithEmptyArray1BoxedString
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedList +data class RequiredWithEmptyArray1BoxedList
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedMap +data class RequiredWithEmptyArray1BoxedMap
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedMap([RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1 +class RequiredWithEmptyArray1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | validate(arg: [Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEmptyArrayMapBuilder +class RequiredWithEmptyArrayMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArrayMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Map) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEmptyArrayMap +class RequiredWithEmptyArrayMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | of([Map](#requiredwithemptyarraymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md new file mode 100644 index 00000000000..eb8d365df0d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md @@ -0,0 +1,2884 @@ +# RequiredWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.RequiredWithEscapedCharacters.java +class RequiredWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](#requiredwithescapedcharacters1)
schema class | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMapBuilder](#requiredwithescapedcharactersmapbuilder)
builder for Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap)
output class for Map payloads | + +## RequiredWithEscapedCharacters1Boxed +sealed interface RequiredWithEscapedCharacters1Boxed
+permits
+[RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid), +[RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean), +[RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber), +[RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring), +[RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist), +[RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEscapedCharacters1BoxedVoid +data class RequiredWithEscapedCharacters1BoxedVoid
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedBoolean +data class RequiredWithEscapedCharacters1BoxedBoolean
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedNumber +data class RequiredWithEscapedCharacters1BoxedNumber
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedString +data class RequiredWithEscapedCharacters1BoxedString
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedList +data class RequiredWithEscapedCharacters1BoxedList
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedMap +data class RequiredWithEscapedCharacters1BoxedMap
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedMap([RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1 +class RequiredWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "foo\tbar",
    "foo\nbar",
    "foo\u000Cbar",
    "foo\rbar",
    "foo\"bar",
    "foo\\bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | validate(arg: [Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEscapedCharactersMap000000Builder +class RequiredWithEscapedCharactersMap000000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEscapedCharactersMap000001Builder +class RequiredWithEscapedCharactersMap000001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000010Builder +class RequiredWithEscapedCharactersMap000010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000011Builder +class RequiredWithEscapedCharactersMap000011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000100Builder +class RequiredWithEscapedCharactersMap000100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap000101Builder +class RequiredWithEscapedCharactersMap000101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000110Builder +class RequiredWithEscapedCharactersMap000110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000111Builder +class RequiredWithEscapedCharactersMap000111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001000Builder +class RequiredWithEscapedCharactersMap001000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap001001Builder +class RequiredWithEscapedCharactersMap001001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001010Builder +class RequiredWithEscapedCharactersMap001010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001011Builder +class RequiredWithEscapedCharactersMap001011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001100Builder +class RequiredWithEscapedCharactersMap001100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap001101Builder +class RequiredWithEscapedCharactersMap001101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001110Builder +class RequiredWithEscapedCharactersMap001110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001111Builder +class RequiredWithEscapedCharactersMap001111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010000Builder +class RequiredWithEscapedCharactersMap010000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap010001Builder +class RequiredWithEscapedCharactersMap010001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010010Builder +class RequiredWithEscapedCharactersMap010010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010011Builder +class RequiredWithEscapedCharactersMap010011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010100Builder +class RequiredWithEscapedCharactersMap010100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap010101Builder +class RequiredWithEscapedCharactersMap010101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010110Builder +class RequiredWithEscapedCharactersMap010110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010111Builder +class RequiredWithEscapedCharactersMap010111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011000Builder +class RequiredWithEscapedCharactersMap011000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap011001Builder +class RequiredWithEscapedCharactersMap011001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011010Builder +class RequiredWithEscapedCharactersMap011010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011011Builder +class RequiredWithEscapedCharactersMap011011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011100Builder +class RequiredWithEscapedCharactersMap011100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap011101Builder +class RequiredWithEscapedCharactersMap011101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011110Builder +class RequiredWithEscapedCharactersMap011110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011111Builder +class RequiredWithEscapedCharactersMap011111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100000Builder +class RequiredWithEscapedCharactersMap100000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Map) | + +## RequiredWithEscapedCharactersMap100001Builder +class RequiredWithEscapedCharactersMap100001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100010Builder +class RequiredWithEscapedCharactersMap100010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100011Builder +class RequiredWithEscapedCharactersMap100011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100100Builder +class RequiredWithEscapedCharactersMap100100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap100101Builder +class RequiredWithEscapedCharactersMap100101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100110Builder +class RequiredWithEscapedCharactersMap100110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100111Builder +class RequiredWithEscapedCharactersMap100111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101000Builder +class RequiredWithEscapedCharactersMap101000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap101001Builder +class RequiredWithEscapedCharactersMap101001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101010Builder +class RequiredWithEscapedCharactersMap101010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101011Builder +class RequiredWithEscapedCharactersMap101011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101100Builder +class RequiredWithEscapedCharactersMap101100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap101101Builder +class RequiredWithEscapedCharactersMap101101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101110Builder +class RequiredWithEscapedCharactersMap101110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101111Builder +class RequiredWithEscapedCharactersMap101111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110000Builder +class RequiredWithEscapedCharactersMap110000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap110001Builder +class RequiredWithEscapedCharactersMap110001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110010Builder +class RequiredWithEscapedCharactersMap110010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110011Builder +class RequiredWithEscapedCharactersMap110011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110100Builder +class RequiredWithEscapedCharactersMap110100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap110101Builder +class RequiredWithEscapedCharactersMap110101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110110Builder +class RequiredWithEscapedCharactersMap110110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110111Builder +class RequiredWithEscapedCharactersMap110111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111000Builder +class RequiredWithEscapedCharactersMap111000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap111001Builder +class RequiredWithEscapedCharactersMap111001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111010Builder +class RequiredWithEscapedCharactersMap111010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap111011Builder +class RequiredWithEscapedCharactersMap111011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111100Builder +class RequiredWithEscapedCharactersMap111100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap111101Builder +class RequiredWithEscapedCharactersMap111101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111110Builder +class RequiredWithEscapedCharactersMap111110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMapBuilder +class RequiredWithEscapedCharactersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap +class RequiredWithEscapedCharactersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | of([Map](#requiredwithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["foo\tbar"], instance["foo\nbar"], instance["foo\u000Cbar"], instance["foo\rbar"], instance["foo\"bar"], instance["foo\\bar"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md new file mode 100644 index 00000000000..08da7286908 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md @@ -0,0 +1,141 @@ +# SimpleEnumValidation +org.openapijsonschematools.client.components.schemas.SimpleEnumValidation.java +class SimpleEnumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SimpleEnumValidation.SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed)
sealed interface for validated payloads | +| record | [SimpleEnumValidation.SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber)
boxed class to store validated Number payloads | +| static class | [SimpleEnumValidation.SimpleEnumValidation1](#simpleenumvalidation1)
schema class | +| enum | [SimpleEnumValidation.IntegerSimpleEnumValidationEnums](#integersimpleenumvalidationenums)
Integer enum | +| enum | [SimpleEnumValidation.LongSimpleEnumValidationEnums](#longsimpleenumvalidationenums)
Long enum | +| enum | [SimpleEnumValidation.FloatSimpleEnumValidationEnums](#floatsimpleenumvalidationenums)
Float enum | +| enum | [SimpleEnumValidation.DoubleSimpleEnumValidationEnums](#doublesimpleenumvalidationenums)
Double enum | + +## SimpleEnumValidation1Boxed +sealed interface SimpleEnumValidation1Boxed
+permits
+[SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SimpleEnumValidation1BoxedNumber +data class SimpleEnumValidation1BoxedNumber
+implements [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleEnumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## SimpleEnumValidation1 +class SimpleEnumValidation1
+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.SimpleEnumValidation; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = SimpleEnumValidation.SimpleEnumValidation1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    1,
    2,
    3
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerSimpleEnumValidationEnums +public enum IntegerSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | +| POSITIVE_2 | value = 2 | +| POSITIVE_3 | value = 3 | + +## LongSimpleEnumValidationEnums +public enum LongSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | +| POSITIVE_2 | value = 2L | +| POSITIVE_3 | value = 3L | + +## FloatSimpleEnumValidationEnums +public enum FloatSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | +| POSITIVE_2 | value = 2.0f | +| POSITIVE_3 | value = 3.0f | + +## DoubleSimpleEnumValidationEnums +public enum DoubleSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | +| POSITIVE_2 | value = 2.0d | +| POSITIVE_3 | value = 3.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md new file mode 100644 index 00000000000..30d0ca293d7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md @@ -0,0 +1,52 @@ +# StringTypeMatchesStrings +org.openapijsonschematools.client.components.schemas.StringTypeMatchesStrings.java +class StringTypeMatchesStrings
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringTypeMatchesStrings.StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed)
sealed interface for validated payloads | +| record | [StringTypeMatchesStrings.StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring)
boxed class to store validated String payloads | +| static class | [StringTypeMatchesStrings.StringTypeMatchesStrings1](#stringtypematchesstrings1)
schema class | + +## StringTypeMatchesStrings1Boxed +sealed interface StringTypeMatchesStrings1Boxed
+permits
+[StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringTypeMatchesStrings1BoxedString +data class StringTypeMatchesStrings1BoxedString
+implements [StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringTypeMatchesStrings1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## StringTypeMatchesStrings1 +class StringTypeMatchesStrings1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md new file mode 100644 index 00000000000..e6bd7249646 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.md @@ -0,0 +1,205 @@ +# TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing +org.openapijsonschematools.client.components.schemas.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.java +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxed)
sealed interface for validated payloads | +| record | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxedmap)
boxed class to store validated Map payloads | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1)
schema class | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder)
builder for Map payloads | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap)
output class for Map payloads | +| sealed interface | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.AlphaBoxed](#alphaboxed)
sealed interface for validated payloads | +| record | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.AlphaBoxedNumber](#alphaboxednumber)
boxed class to store validated Number payloads | +| static class | [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.Alpha](#alpha)
schema class | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed +sealed interface TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed
+permits
+[TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap +data class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap
+implements [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap([TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1
+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.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap validatedPayload = + TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.validate( + new TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder() + .alpha(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "alpha" to [Alpha::class.java](#alpha))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) | validate(arg: [Map<?, ?>](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder), configuration: SchemaConfiguration) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxedmap) | validateAndBox([Map<?, ?>](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder), configuration: SchemaConfiguration) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed](#thedefaultkeyworddoesnotdoanythingifthepropertyismissing1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Int) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Float) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Long) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | alpha(value: Double) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: String) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Int) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Float) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Long) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Double) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: List) | +| [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) | additionalProperty(key: String, value: Map) | + +## TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmap) | of([Map](#thedefaultkeyworddoesnotdoanythingifthepropertyismissingmapbuilder) arg, SchemaConfiguration configuration) | +| Number | alpha()
[optional] if omitted the server will use the default value of 5.0 | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AlphaBoxed +sealed interface AlphaBoxed
+permits
+[AlphaBoxedNumber](#alphaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## AlphaBoxedNumber +data class AlphaBoxedNumber
+implements [AlphaBoxed](#alphaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AlphaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Alpha +class Alpha
+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.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.Alpha.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Number | maximum = 3 | +| Any? | defaultValue = 5.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [AlphaBoxedNumber](#alphaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AlphaBoxed](#alphaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md new file mode 100644 index 00000000000..5529c997fa9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsFalseValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsFalseValidation.java +class UniqueitemsFalseValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](#uniqueitemsfalsevalidation1)
schema class | + +## UniqueitemsFalseValidation1Boxed +sealed interface UniqueitemsFalseValidation1Boxed
+permits
+[UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid), +[UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean), +[UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber), +[UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring), +[UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist), +[UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsFalseValidation1BoxedVoid +data class UniqueitemsFalseValidation1BoxedVoid
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedBoolean +data class UniqueitemsFalseValidation1BoxedBoolean
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedNumber +data class UniqueitemsFalseValidation1BoxedNumber
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedString +data class UniqueitemsFalseValidation1BoxedString
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedList +data class UniqueitemsFalseValidation1BoxedList
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedMap +data class UniqueitemsFalseValidation1BoxedMap
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1 +class UniqueitemsFalseValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = false | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md new file mode 100644 index 00000000000..09861dec784 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsValidation.java +class UniqueitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsValidation.UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsValidation.UniqueitemsValidation1](#uniqueitemsvalidation1)
schema class | + +## UniqueitemsValidation1Boxed +sealed interface UniqueitemsValidation1Boxed
+permits
+[UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid), +[UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean), +[UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber), +[UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring), +[UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist), +[UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsValidation1BoxedVoid +data class UniqueitemsValidation1BoxedVoid
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedBoolean +data class UniqueitemsValidation1BoxedBoolean
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedNumber +data class UniqueitemsValidation1BoxedNumber
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedString +data class UniqueitemsValidation1BoxedString
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedList +data class UniqueitemsValidation1BoxedList
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedMap +data class UniqueitemsValidation1BoxedMap
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1 +class UniqueitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = true | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriFormat.md new file mode 100644 index 00000000000..ee78e984294 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriFormat.md @@ -0,0 +1,169 @@ +# UriFormat +org.openapijsonschematools.client.components.schemas.UriFormat.java +class UriFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriFormat.UriFormat1Boxed](#uriformat1boxed)
sealed interface for validated payloads | +| record | [UriFormat.UriFormat1BoxedVoid](#uriformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriFormat.UriFormat1BoxedBoolean](#uriformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriFormat.UriFormat1BoxedNumber](#uriformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriFormat.UriFormat1BoxedString](#uriformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriFormat.UriFormat1BoxedList](#uriformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriFormat.UriFormat1BoxedMap](#uriformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriFormat.UriFormat1](#uriformat1)
schema class | + +## UriFormat1Boxed +sealed interface UriFormat1Boxed
+permits
+[UriFormat1BoxedVoid](#uriformat1boxedvoid), +[UriFormat1BoxedBoolean](#uriformat1boxedboolean), +[UriFormat1BoxedNumber](#uriformat1boxednumber), +[UriFormat1BoxedString](#uriformat1boxedstring), +[UriFormat1BoxedList](#uriformat1boxedlist), +[UriFormat1BoxedMap](#uriformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriFormat1BoxedVoid +data class UriFormat1BoxedVoid
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedBoolean +data class UriFormat1BoxedBoolean
+implements [UriFormat1Boxed](#uriformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedNumber +data class UriFormat1BoxedNumber
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedString +data class UriFormat1BoxedString
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedList +data class UriFormat1BoxedList
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedMap +data class UriFormat1BoxedMap
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1 +class UriFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedString](#uriformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriFormat1BoxedVoid](#uriformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriFormat1BoxedNumber](#uriformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriFormat1BoxedBoolean](#uriformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriFormat1BoxedMap](#uriformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedList](#uriformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriFormat1Boxed](#uriformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md new file mode 100644 index 00000000000..34c794017c3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md @@ -0,0 +1,169 @@ +# UriReferenceFormat +org.openapijsonschematools.client.components.schemas.UriReferenceFormat.java +class UriReferenceFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriReferenceFormat.UriReferenceFormat1Boxed](#urireferenceformat1boxed)
sealed interface for validated payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriReferenceFormat.UriReferenceFormat1](#urireferenceformat1)
schema class | + +## UriReferenceFormat1Boxed +sealed interface UriReferenceFormat1Boxed
+permits
+[UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid), +[UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean), +[UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber), +[UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring), +[UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist), +[UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriReferenceFormat1BoxedVoid +data class UriReferenceFormat1BoxedVoid
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedBoolean +data class UriReferenceFormat1BoxedBoolean
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedNumber +data class UriReferenceFormat1BoxedNumber
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedString +data class UriReferenceFormat1BoxedString
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedList +data class UriReferenceFormat1BoxedList
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedMap +data class UriReferenceFormat1BoxedMap
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1 +class UriReferenceFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-reference"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1Boxed](#urireferenceformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md new file mode 100644 index 00000000000..1c17c912d35 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md @@ -0,0 +1,169 @@ +# UriTemplateFormat +org.openapijsonschematools.client.components.schemas.UriTemplateFormat.java +class UriTemplateFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriTemplateFormat.UriTemplateFormat1Boxed](#uritemplateformat1boxed)
sealed interface for validated payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriTemplateFormat.UriTemplateFormat1](#uritemplateformat1)
schema class | + +## UriTemplateFormat1Boxed +sealed interface UriTemplateFormat1Boxed
+permits
+[UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid), +[UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean), +[UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber), +[UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring), +[UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist), +[UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriTemplateFormat1BoxedVoid +data class UriTemplateFormat1BoxedVoid
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedBoolean +data class UriTemplateFormat1BoxedBoolean
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedNumber +data class UriTemplateFormat1BoxedNumber
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedString +data class UriTemplateFormat1BoxedString
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedList +data class UriTemplateFormat1BoxedList
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedMap +data class UriTemplateFormat1BoxedMap
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1 +class UriTemplateFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-template"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1Boxed](#uritemplateformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/docs/servers/RootServer0.md b/samples/client/3_0_3_unit_test/kotlin/docs/servers/RootServer0.md new file mode 100644 index 00000000000..08ddb1be947 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/docs/servers/RootServer0.md @@ -0,0 +1,17 @@ +org.openapijsonschematools.client.servers.RootServer0 +# Server RootServer0 +public class RootServer0 + +A class that stores a server url + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer0()
Creates a server | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://someserver.com/v1" | + +[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/3_0_3_unit_test/kotlin/settings.gradle.kts b/samples/client/3_0_3_unit_test/kotlin/settings.gradle.kts new file mode 100644 index 00000000000..65c368589f6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "unit-test-api" + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt new file mode 100644 index 00000000000..2d583252938 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client + +import org.openapijsonschematools.client.servers.RootServer0 +import org.openapijsonschematools.client.servers.Server +import org.openapijsonschematools.client.servers.ServerProvider + +class RootServerInfo { + class RootServerInfo1( + private val server0: RootServer0 = RootServer0() + ) : ServerProvider { + + override fun getServer(serverIndex: ServerIndex): Server { + return server0 + } + } + + enum class ServerIndex { + SERVER_0 + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt new file mode 100644 index 00000000000..c7945bd6c82 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.kt @@ -0,0 +1,351 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesAllowsASchemaWhichShouldValidate { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesAllowsASchemaWhichShouldValidateMap { + return AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + val value = getOrThrow(name) + if (!(value is Boolean)) { + throw RuntimeException("Invalid value stored for " + name) + } + return value + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap(val data: AdditionalpropertiesAllowsASchemaWhichShouldValidateMap) : AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesAllowsASchemaWhichShouldValidate1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesAllowsASchemaWhichShouldValidate1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesAllowsASchemaWhichShouldValidateMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAllowsASchemaWhichShouldValidateMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap { + return AdditionalpropertiesAllowsASchemaWhichShouldValidate1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesAllowsASchemaWhichShouldValidate1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt new file mode 100644 index 00000000000..2966b3216d6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt @@ -0,0 +1,518 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesAreAllowedByDefault { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesAreAllowedByDefaultMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesAreAllowedByDefaultMap { + return AdditionalpropertiesAreAllowedByDefault1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AdditionalpropertiesAreAllowedByDefaultMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid(val data: Nothing?) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(val data: Boolean): AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber(val data: Number) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedString(val data: String) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedList(val data: FrozenList) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedMap(val data: AdditionalpropertiesAreAllowedByDefaultMap) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesAreAllowedByDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesAreAllowedByDefault1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesAreAllowedByDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesAreAllowedByDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesAreAllowedByDefaultMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesAreAllowedByDefaultMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefaultMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedVoid { + return AdditionalpropertiesAreAllowedByDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedBoolean { + return AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedNumber { + return AdditionalpropertiesAreAllowedByDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedString { + return AdditionalpropertiesAreAllowedByDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedList { + return AdditionalpropertiesAreAllowedByDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedMap { + return AdditionalpropertiesAreAllowedByDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt new file mode 100644 index 00000000000..ee604cec42a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesCanExistByItself { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class AdditionalpropertiesCanExistByItselfMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesCanExistByItselfMap { + return AdditionalpropertiesCanExistByItself1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesCanExistByItselfMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesCanExistByItselfMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesCanExistByItself1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesCanExistByItself1BoxedMap(val data: AdditionalpropertiesCanExistByItselfMap) : AdditionalpropertiesCanExistByItself1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesCanExistByItself1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesCanExistByItself1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesCanExistByItself1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesCanExistByItselfMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesCanExistByItselfMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItselfMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1BoxedMap { + return AdditionalpropertiesCanExistByItself1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt new file mode 100644 index 00000000000..9b2caf72cfb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.kt @@ -0,0 +1,787 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesShouldNotLookInApplicators { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0MapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0MapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0MapBuilder { + return this + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class AdditionalpropertiesShouldNotLookInApplicatorsMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesShouldNotLookInApplicatorsMap { + return AdditionalpropertiesShouldNotLookInApplicators1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesShouldNotLookInApplicatorsMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesShouldNotLookInApplicators1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid(val data: Nothing?) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean(val data: Boolean): AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber(val data: Number) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedString(val data: String) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedList(val data: FrozenList) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesShouldNotLookInApplicators1BoxedMap(val data: AdditionalpropertiesShouldNotLookInApplicatorsMap) : AdditionalpropertiesShouldNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesShouldNotLookInApplicators1 private constructor(): JsonSchema( + JsonSchemaInfo() + .additionalProperties(AdditionalProperties::class.java) + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesShouldNotLookInApplicators1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesShouldNotLookInApplicators1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesShouldNotLookInApplicators1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesShouldNotLookInApplicatorsMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesShouldNotLookInApplicatorsMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicatorsMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedString { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedList { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1BoxedMap { + return AdditionalpropertiesShouldNotLookInApplicators1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesShouldNotLookInApplicators1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt new file mode 100644 index 00000000000..4d04ec0291e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Allof { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Allof1Boxed { + fun getData(): Any? + } + + data class Allof1BoxedVoid(val data: Nothing?) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedBoolean(val data: Boolean): Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedNumber(val data: Number) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedString(val data: String) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedList(val data: FrozenList) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedMap(val data: FrozenMap) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Allof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Allof1BoxedList>, MapSchemaValidator, Allof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Allof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Allof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Allof1BoxedVoid { + return Allof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Allof1BoxedBoolean { + return Allof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Allof1BoxedNumber { + return Allof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Allof1BoxedString { + return Allof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Allof1BoxedList { + return Allof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Allof1BoxedMap { + return Allof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Allof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt new file mode 100644 index 00000000000..22448768881 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt @@ -0,0 +1,1142 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofCombinedWithAnyofOneof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema02Boxed { + fun getData(): Any? + } + + data class Schema02BoxedVoid(val data: Nothing?) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedBoolean(val data: Boolean): Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedNumber(val data: Number) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedString(val data: String) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedList(val data: FrozenList) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedMap(val data: FrozenMap) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema02 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema02BoxedList>, MapSchemaValidator, Schema02BoxedMap> { + + companion object { + @Volatile + private var instance: Schema02? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema02().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema02BoxedVoid { + return Schema02BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema02BoxedBoolean { + return Schema02BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema02BoxedNumber { + return Schema02BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema02BoxedString { + return Schema02BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema02BoxedList { + return Schema02BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema02BoxedMap { + return Schema02BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema02Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema01Boxed { + fun getData(): Any? + } + + data class Schema01BoxedVoid(val data: Nothing?) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedBoolean(val data: Boolean): Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedNumber(val data: Number) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedString(val data: String) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedList(val data: FrozenList) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedMap(val data: FrozenMap) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema01 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema01BoxedList>, MapSchemaValidator, Schema01BoxedMap> { + + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema01BoxedVoid { + return Schema01BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema01BoxedBoolean { + return Schema01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema01BoxedNumber { + return Schema01BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema01BoxedString { + return Schema01BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema01BoxedList { + return Schema01BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema01BoxedMap { + return Schema01BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema01Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofCombinedWithAnyofOneof1Boxed { + fun getData(): Any? + } + + data class AllofCombinedWithAnyofOneof1BoxedVoid(val data: Nothing?) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedBoolean(val data: Boolean): AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedNumber(val data: Number) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedString(val data: String) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedList(val data: FrozenList) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedMap(val data: FrozenMap) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofCombinedWithAnyofOneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema02::class.java + )) + .anyOf(listOf( + Schema01::class.java + )) + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofCombinedWithAnyofOneof1BoxedList>, MapSchemaValidator, AllofCombinedWithAnyofOneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofCombinedWithAnyofOneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofCombinedWithAnyofOneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedVoid { + return AllofCombinedWithAnyofOneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedBoolean { + return AllofCombinedWithAnyofOneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedNumber { + return AllofCombinedWithAnyofOneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedString { + return AllofCombinedWithAnyofOneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedList { + return AllofCombinedWithAnyofOneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedMap { + return AllofCombinedWithAnyofOneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt new file mode 100644 index 00000000000..1311748cc47 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt @@ -0,0 +1,861 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofSimpleTypes { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(30) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(20) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofSimpleTypes1Boxed { + fun getData(): Any? + } + + data class AllofSimpleTypes1BoxedVoid(val data: Nothing?) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedBoolean(val data: Boolean): AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedNumber(val data: Number) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedString(val data: String) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedList(val data: FrozenList) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedMap(val data: FrozenMap) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofSimpleTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofSimpleTypes1BoxedList>, MapSchemaValidator, AllofSimpleTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofSimpleTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofSimpleTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedVoid { + return AllofSimpleTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedBoolean { + return AllofSimpleTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedNumber { + return AllofSimpleTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedString { + return AllofSimpleTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedList { + return AllofSimpleTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedMap { + return AllofSimpleTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofSimpleTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt new file mode 100644 index 00000000000..434a6b3cac3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt @@ -0,0 +1,1151 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Baz : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Baz? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Baz().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Nothing? { + val value: Any? = get("baz") + if (!(value == null || value is Nothing?)) { + throw RuntimeException("Invalid value stored for baz") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForBaz { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "baz" to Baz::class.java + )) + .required(setOf( + "baz" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AllofWithBaseSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AllofWithBaseSchemaMap { + return AllofWithBaseSchema1.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AllofWithBaseSchemaMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return this + } + } + + class AllofWithBaseSchemaMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return AllofWithBaseSchemaMap0Builder(instance) + } + } + + + sealed interface AllofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AllofWithBaseSchema1BoxedVoid(val data: Nothing?) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedBoolean(val data: Boolean): AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedNumber(val data: Number) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedString(val data: String) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedList(val data: FrozenList) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedMap(val data: AllofWithBaseSchemaMap) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithBaseSchema1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AllofWithBaseSchemaMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AllofWithBaseSchemaMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedVoid { + return AllofWithBaseSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedBoolean { + return AllofWithBaseSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedNumber { + return AllofWithBaseSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedString { + return AllofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedList { + return AllofWithBaseSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedMap { + return AllofWithBaseSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithBaseSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt new file mode 100644 index 00000000000..d52dc7697e6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt @@ -0,0 +1,324 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface AllofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedNumber(val data: Number) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedString(val data: String) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedList(val data: FrozenList) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AllofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedVoid { + return AllofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedBoolean { + return AllofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedNumber { + return AllofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedString { + return AllofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedList { + return AllofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedMap { + return AllofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt new file mode 100644 index 00000000000..05bc227949a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheFirstEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheFirstEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheFirstEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedNumber(val data: Number) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedString(val data: String) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheFirstEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheFirstEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheFirstEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheFirstEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheFirstEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedVoid { + return AllofWithTheFirstEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedBoolean { + return AllofWithTheFirstEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedNumber { + return AllofWithTheFirstEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedString { + return AllofWithTheFirstEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedList { + return AllofWithTheFirstEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedMap { + return AllofWithTheFirstEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt new file mode 100644 index 00000000000..fa3b00d842e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheLastEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheLastEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheLastEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedNumber(val data: Number) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedString(val data: String) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheLastEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheLastEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheLastEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheLastEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheLastEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedVoid { + return AllofWithTheLastEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedBoolean { + return AllofWithTheLastEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedNumber { + return AllofWithTheLastEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedString { + return AllofWithTheLastEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedList { + return AllofWithTheLastEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedMap { + return AllofWithTheLastEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt new file mode 100644 index 00000000000..6ac254eada1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt @@ -0,0 +1,338 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTwoEmptySchemas { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTwoEmptySchemas1Boxed { + fun getData(): Any? + } + + data class AllofWithTwoEmptySchemas1BoxedVoid(val data: Nothing?) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedBoolean(val data: Boolean): AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedNumber(val data: Number) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedString(val data: String) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedList(val data: FrozenList) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedMap(val data: FrozenMap) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTwoEmptySchemas1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTwoEmptySchemas1BoxedList>, MapSchemaValidator, AllofWithTwoEmptySchemas1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTwoEmptySchemas1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTwoEmptySchemas1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedVoid { + return AllofWithTwoEmptySchemas1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedBoolean { + return AllofWithTwoEmptySchemas1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedNumber { + return AllofWithTwoEmptySchemas1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedString { + return AllofWithTwoEmptySchemas1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedList { + return AllofWithTwoEmptySchemas1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedMap { + return AllofWithTwoEmptySchemas1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt new file mode 100644 index 00000000000..c71b31c6ce0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Anyof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Anyof1Boxed { + fun getData(): Any? + } + + data class Anyof1BoxedVoid(val data: Nothing?) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedBoolean(val data: Boolean): Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedNumber(val data: Number) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedString(val data: String) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedList(val data: FrozenList) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedMap(val data: FrozenMap) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Anyof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Anyof1BoxedList>, MapSchemaValidator, Anyof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Anyof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Anyof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Anyof1BoxedVoid { + return Anyof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Anyof1BoxedBoolean { + return Anyof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Anyof1BoxedNumber { + return Anyof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Anyof1BoxedString { + return Anyof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Anyof1BoxedList { + return Anyof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Anyof1BoxedMap { + return Anyof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Anyof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt new file mode 100644 index 00000000000..8abf0c0c3cb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofComplexTypes1Boxed { + fun getData(): Any? + } + + data class AnyofComplexTypes1BoxedVoid(val data: Nothing?) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedBoolean(val data: Boolean): AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedNumber(val data: Number) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedString(val data: String) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedList(val data: FrozenList) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedMap(val data: FrozenMap) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofComplexTypes1BoxedList>, MapSchemaValidator, AnyofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedVoid { + return AnyofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedBoolean { + return AnyofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedNumber { + return AnyofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedString { + return AnyofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedList { + return AnyofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedMap { + return AnyofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt new file mode 100644 index 00000000000..c6c6cd7ba74 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithBaseSchema1BoxedString(val data: String) : AnyofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class AnyofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithBaseSchema1BoxedString { + return AnyofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt new file mode 100644 index 00000000000..6bd29945cdc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AnyofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedNumber(val data: Number) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedString(val data: String) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedList(val data: FrozenList) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AnyofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedVoid { + return AnyofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedBoolean { + return AnyofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedNumber { + return AnyofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedString { + return AnyofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedList { + return AnyofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedMap { + return AnyofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt new file mode 100644 index 00000000000..2493505f33d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt @@ -0,0 +1,187 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ArrayTypeMatchesArrays { + // nest classes so all schemas and input/output classes can be public + + + class Items : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class ArrayTypeMatchesArraysList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayTypeMatchesArraysList { + return ArrayTypeMatchesArrays1.getInstance().validate(arg, configuration) + } + } + } + + class ArrayTypeMatchesArraysListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ArrayTypeMatchesArraysListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: String): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ArrayTypeMatchesArraysListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ArrayTypeMatchesArrays1Boxed { + fun getData(): Any? + } + + data class ArrayTypeMatchesArrays1BoxedList(val data: ArrayTypeMatchesArraysList) : ArrayTypeMatchesArrays1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ArrayTypeMatchesArrays1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ArrayTypeMatchesArrays1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ArrayTypeMatchesArrays1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ArrayTypeMatchesArraysList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ArrayTypeMatchesArraysList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayTypeMatchesArraysList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayTypeMatchesArrays1BoxedList { + return ArrayTypeMatchesArrays1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayTypeMatchesArrays1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt new file mode 100644 index 00000000000..f557463b4d8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.BooleanJsonSchema + +class BooleanTypeMatchesBooleans: BooleanJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class BooleanTypeMatchesBooleans1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: BooleanTypeMatchesBooleans1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanTypeMatchesBooleans1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt new file mode 100644 index 00000000000..e02942f3d65 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByInt { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByInt1Boxed { + fun getData(): Any? + } + + data class ByInt1BoxedVoid(val data: Nothing?) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedBoolean(val data: Boolean): ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedNumber(val data: Number) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedString(val data: String) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedList(val data: FrozenList) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedMap(val data: FrozenMap) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByInt1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByInt1BoxedList>, MapSchemaValidator, ByInt1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByInt1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByInt1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByInt1BoxedVoid { + return ByInt1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByInt1BoxedBoolean { + return ByInt1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByInt1BoxedNumber { + return ByInt1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByInt1BoxedString { + return ByInt1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByInt1BoxedList { + return ByInt1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByInt1BoxedMap { + return ByInt1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByInt1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt new file mode 100644 index 00000000000..92ab5a5ee41 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByNumber1Boxed { + fun getData(): Any? + } + + data class ByNumber1BoxedVoid(val data: Nothing?) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedBoolean(val data: Boolean): ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedNumber(val data: Number) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedString(val data: String) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedList(val data: FrozenList) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedMap(val data: FrozenMap) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("1.5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByNumber1BoxedList>, MapSchemaValidator, ByNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByNumber1BoxedVoid { + return ByNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByNumber1BoxedBoolean { + return ByNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByNumber1BoxedNumber { + return ByNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByNumber1BoxedString { + return ByNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByNumber1BoxedList { + return ByNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByNumber1BoxedMap { + return ByNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt new file mode 100644 index 00000000000..3f9c9b3ffe9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class BySmallNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface BySmallNumber1Boxed { + fun getData(): Any? + } + + data class BySmallNumber1BoxedVoid(val data: Nothing?) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedBoolean(val data: Boolean): BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedNumber(val data: Number) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedString(val data: String) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedList(val data: FrozenList) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedMap(val data: FrozenMap) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class BySmallNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("0.00010")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BySmallNumber1BoxedList>, MapSchemaValidator, BySmallNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: BySmallNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BySmallNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): BySmallNumber1BoxedVoid { + return BySmallNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BySmallNumber1BoxedBoolean { + return BySmallNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): BySmallNumber1BoxedNumber { + return BySmallNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BySmallNumber1BoxedString { + return BySmallNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BySmallNumber1BoxedList { + return BySmallNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BySmallNumber1BoxedMap { + return BySmallNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BySmallNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt new file mode 100644 index 00000000000..034656f3583 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DateTimeFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DateTimeFormat1Boxed { + fun getData(): Any? + } + + data class DateTimeFormat1BoxedVoid(val data: Nothing?) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedBoolean(val data: Boolean): DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedNumber(val data: Number) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedString(val data: String) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedList(val data: FrozenList) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedMap(val data: FrozenMap) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DateTimeFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("date-time") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateTimeFormat1BoxedList>, MapSchemaValidator, DateTimeFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DateTimeFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DateTimeFormat1BoxedVoid { + return DateTimeFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DateTimeFormat1BoxedBoolean { + return DateTimeFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DateTimeFormat1BoxedNumber { + return DateTimeFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeFormat1BoxedString { + return DateTimeFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedList { + return DateTimeFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedMap { + return DateTimeFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt new file mode 100644 index 00000000000..ed88a6dc0c5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EmailFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface EmailFormat1Boxed { + fun getData(): Any? + } + + data class EmailFormat1BoxedVoid(val data: Nothing?) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedBoolean(val data: Boolean): EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedNumber(val data: Number) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedString(val data: String) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedList(val data: FrozenList) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedMap(val data: FrozenMap) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EmailFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("email") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EmailFormat1BoxedList>, MapSchemaValidator, EmailFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EmailFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EmailFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): EmailFormat1BoxedVoid { + return EmailFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EmailFormat1BoxedBoolean { + return EmailFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EmailFormat1BoxedNumber { + return EmailFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EmailFormat1BoxedString { + return EmailFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): EmailFormat1BoxedList { + return EmailFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EmailFormat1BoxedMap { + return EmailFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EmailFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt new file mode 100644 index 00000000000..5d94f419354 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith0DoesNotMatchFalse { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith0DoesNotMatchFalseEnums(private val value: Int): IntegerValueMethod { + POSITIVE_0(0); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith0DoesNotMatchFalseEnums(private val value: Long): LongValueMethod { + POSITIVE_0(0L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith0DoesNotMatchFalseEnums(private val value: Float): FloatValueMethod { + POSITIVE_0(0.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith0DoesNotMatchFalseEnums(private val value: Double): DoubleValueMethod { + POSITIVE_0(0.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith0DoesNotMatchFalse1Boxed { + fun getData(): Any? + } + + data class EnumWith0DoesNotMatchFalse1BoxedNumber(val data: Number) : EnumWith0DoesNotMatchFalse1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith0DoesNotMatchFalse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("0") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith0DoesNotMatchFalse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith0DoesNotMatchFalse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1BoxedNumber { + return EnumWith0DoesNotMatchFalse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt new file mode 100644 index 00000000000..7397d4f728e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith1DoesNotMatchTrue { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith1DoesNotMatchTrueEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith1DoesNotMatchTrueEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith1DoesNotMatchTrueEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith1DoesNotMatchTrueEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith1DoesNotMatchTrue1Boxed { + fun getData(): Any? + } + + data class EnumWith1DoesNotMatchTrue1BoxedNumber(val data: Number) : EnumWith1DoesNotMatchTrue1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith1DoesNotMatchTrue1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith1DoesNotMatchTrue1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith1DoesNotMatchTrue1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1BoxedNumber { + return EnumWith1DoesNotMatchTrue1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt new file mode 100644 index 00000000000..4624e048623 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + enum class StringEnumWithEscapedCharactersEnums(private val value: String): StringValueMethod { + FOO_LINE_FEED_LF_BAR("foo\nbar"), + FOO_CARRIAGE_RETURN_CR_BAR("foo\rbar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface EnumWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class EnumWithEscapedCharacters1BoxedString(val data: String) : EnumWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo\nbar", + "foo\rbar" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringEnumWithEscapedCharactersEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1BoxedString { + return EnumWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt new file mode 100644 index 00000000000..bfc0dd03800 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithFalseDoesNotMatch0 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithFalseDoesNotMatch0Enums(private val value: Boolean): BooleanValueMethod { + FALSE(false); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithFalseDoesNotMatch01Boxed { + fun getData(): Any? + } + + data class EnumWithFalseDoesNotMatch01BoxedBoolean(val data: Boolean): EnumWithFalseDoesNotMatch01Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithFalseDoesNotMatch01 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + false + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithFalseDoesNotMatch01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithFalseDoesNotMatch01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithFalseDoesNotMatch0Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01BoxedBoolean { + return EnumWithFalseDoesNotMatch01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt new file mode 100644 index 00000000000..2df59f8e594 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithTrueDoesNotMatch1 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithTrueDoesNotMatch1Enums(private val value: Boolean): BooleanValueMethod { + TRUE(true); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithTrueDoesNotMatch11Boxed { + fun getData(): Any? + } + + data class EnumWithTrueDoesNotMatch11BoxedBoolean(val data: Boolean): EnumWithTrueDoesNotMatch11Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithTrueDoesNotMatch11 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + true + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithTrueDoesNotMatch11? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithTrueDoesNotMatch11().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithTrueDoesNotMatch1Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11BoxedBoolean { + return EnumWithTrueDoesNotMatch11BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt new file mode 100644 index 00000000000..50712e368ae --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt @@ -0,0 +1,394 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumsInProperties { + // nest classes so all schemas and input/output classes can be public + + enum class StringFooEnums(private val value: String): StringValueMethod { + FOO("foo"); + + override fun value(): String { + return this.value + } + } + + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedString(val data: String) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringFooEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FooBoxedString { + return FooBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + enum class StringBarEnums(private val value: String): StringValueMethod { + BAR("bar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "bar" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringBarEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class EnumsInPropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): EnumsInPropertiesMap { + return EnumsInProperties1.getInstance().validate(arg, configuration) + } + } + + fun bar(): String { + val value: Any? = get("bar") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: StringBarEnums): T { + val instance = getInstance() + instance["bar"] = value.value() + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: StringFooEnums): T { + val instance = getInstance() + instance["foo"] = value.value() + return getBuilderAfterFoo(instance) + } + } + + class EnumsInPropertiesMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + } + + class EnumsInPropertiesMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): EnumsInPropertiesMap0Builder { + return EnumsInPropertiesMap0Builder(instance) + } + } + + + sealed interface EnumsInProperties1Boxed { + fun getData(): Any? + } + + data class EnumsInProperties1BoxedMap(val data: EnumsInPropertiesMap) : EnumsInProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EnumsInProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumsInProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumsInProperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): EnumsInPropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return EnumsInPropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInPropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInProperties1BoxedMap { + return EnumsInProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumsInProperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt new file mode 100644 index 00000000000..8f716213d8c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt @@ -0,0 +1,437 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ForbiddenProperty { + // nest classes so all schemas and input/output classes can be public + + + class Foo : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class ForbiddenPropertyMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ForbiddenPropertyMap { + return ForbiddenProperty1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class ForbiddenPropertyMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + } + + + sealed interface ForbiddenProperty1Boxed { + fun getData(): Any? + } + + data class ForbiddenProperty1BoxedVoid(val data: Nothing?) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedBoolean(val data: Boolean): ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedNumber(val data: Number) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedString(val data: String) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedList(val data: FrozenList) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedMap(val data: ForbiddenPropertyMap) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ForbiddenProperty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ForbiddenProperty1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ForbiddenProperty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ForbiddenProperty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ForbiddenPropertyMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ForbiddenPropertyMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenPropertyMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedVoid { + return ForbiddenProperty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedBoolean { + return ForbiddenProperty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedNumber { + return ForbiddenProperty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedString { + return ForbiddenProperty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedList { + return ForbiddenProperty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedMap { + return ForbiddenProperty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ForbiddenProperty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt new file mode 100644 index 00000000000..63cefc4f9fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class HostnameFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface HostnameFormat1Boxed { + fun getData(): Any? + } + + data class HostnameFormat1BoxedVoid(val data: Nothing?) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedBoolean(val data: Boolean): HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedNumber(val data: Number) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedString(val data: String) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedList(val data: FrozenList) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedMap(val data: FrozenMap) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class HostnameFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("hostname") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, HostnameFormat1BoxedList>, MapSchemaValidator, HostnameFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: HostnameFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: HostnameFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): HostnameFormat1BoxedVoid { + return HostnameFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): HostnameFormat1BoxedBoolean { + return HostnameFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): HostnameFormat1BoxedNumber { + return HostnameFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): HostnameFormat1BoxedString { + return HostnameFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): HostnameFormat1BoxedList { + return HostnameFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): HostnameFormat1BoxedMap { + return HostnameFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): HostnameFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt new file mode 100644 index 00000000000..fef4eb00f39 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.IntJsonSchema + +class IntegerTypeMatchesIntegers: IntJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class IntegerTypeMatchesIntegers1 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: IntegerTypeMatchesIntegers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntegerTypeMatchesIntegers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt new file mode 100644 index 00000000000..37f1f34db0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.kt @@ -0,0 +1,112 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf { + // nest classes so all schemas and input/output classes can be public + + + sealed interface InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed { + fun getData(): Any? + } + + data class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber(val data: Number) : InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("int") + .multipleOf(BigDecimal("0.123456789")) + ), NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber { + return InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt new file mode 100644 index 00000000000..568b9d73278 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefault.kt @@ -0,0 +1,455 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class InvalidStringValueForDefault { + // nest classes so all schemas and input/output classes can be public + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .minLength(4) + .defaultValue("bad") + ), StringSchemaValidator, DefaultValueMethod { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun defaultValue(): String { + if (defaultValue is String) { + return defaultValue + } + throw ValidationException("Invalid type stored in defaultValue") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class InvalidStringValueForDefaultMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): InvalidStringValueForDefaultMap { + return InvalidStringValueForDefault1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): String { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class InvalidStringValueForDefaultMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): InvalidStringValueForDefaultMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): InvalidStringValueForDefaultMapBuilder { + return this + } + } + + + sealed interface InvalidStringValueForDefault1Boxed { + fun getData(): Any? + } + + data class InvalidStringValueForDefault1BoxedVoid(val data: Nothing?) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedBoolean(val data: Boolean): InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedNumber(val data: Number) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedString(val data: String) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedList(val data: FrozenList) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class InvalidStringValueForDefault1BoxedMap(val data: InvalidStringValueForDefaultMap) : InvalidStringValueForDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class InvalidStringValueForDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, InvalidStringValueForDefault1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: InvalidStringValueForDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: InvalidStringValueForDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): InvalidStringValueForDefaultMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return InvalidStringValueForDefaultMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): InvalidStringValueForDefaultMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedVoid { + return InvalidStringValueForDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedBoolean { + return InvalidStringValueForDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedNumber { + return InvalidStringValueForDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedString { + return InvalidStringValueForDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedList { + return InvalidStringValueForDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): InvalidStringValueForDefault1BoxedMap { + return InvalidStringValueForDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): InvalidStringValueForDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt new file mode 100644 index 00000000000..6daf2520bd4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv4Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv4Format1Boxed { + fun getData(): Any? + } + + data class Ipv4Format1BoxedVoid(val data: Nothing?) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedBoolean(val data: Boolean): Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedNumber(val data: Number) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedString(val data: String) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedList(val data: FrozenList) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedMap(val data: FrozenMap) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv4Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv4") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv4Format1BoxedList>, MapSchemaValidator, Ipv4Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv4Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv4Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv4Format1BoxedVoid { + return Ipv4Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv4Format1BoxedBoolean { + return Ipv4Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv4Format1BoxedNumber { + return Ipv4Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv4Format1BoxedString { + return Ipv4Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv4Format1BoxedList { + return Ipv4Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv4Format1BoxedMap { + return Ipv4Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv4Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt new file mode 100644 index 00000000000..e08e410e9ea --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv6Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv6Format1Boxed { + fun getData(): Any? + } + + data class Ipv6Format1BoxedVoid(val data: Nothing?) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedBoolean(val data: Boolean): Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedNumber(val data: Number) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedString(val data: String) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedList(val data: FrozenList) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedMap(val data: FrozenMap) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv6Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv6") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv6Format1BoxedList>, MapSchemaValidator, Ipv6Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv6Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv6Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv6Format1BoxedVoid { + return Ipv6Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv6Format1BoxedBoolean { + return Ipv6Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv6Format1BoxedNumber { + return Ipv6Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv6Format1BoxedString { + return Ipv6Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv6Format1BoxedList { + return Ipv6Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv6Format1BoxedMap { + return Ipv6Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv6Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt new file mode 100644 index 00000000000..b45b9ad16a2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class JsonPointerFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface JsonPointerFormat1Boxed { + fun getData(): Any? + } + + data class JsonPointerFormat1BoxedVoid(val data: Nothing?) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedBoolean(val data: Boolean): JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedNumber(val data: Number) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedString(val data: String) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedList(val data: FrozenList) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedMap(val data: FrozenMap) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class JsonPointerFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("json-pointer") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, JsonPointerFormat1BoxedList>, MapSchemaValidator, JsonPointerFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: JsonPointerFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: JsonPointerFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedVoid { + return JsonPointerFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedBoolean { + return JsonPointerFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedNumber { + return JsonPointerFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedString { + return JsonPointerFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedList { + return JsonPointerFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedMap { + return JsonPointerFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): JsonPointerFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt new file mode 100644 index 00000000000..46d8b221c64 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidation1Boxed { + fun getData(): Any? + } + + data class MaximumValidation1BoxedVoid(val data: Nothing?) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedBoolean(val data: Boolean): MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedNumber(val data: Number) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedString(val data: String) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedList(val data: FrozenList) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedMap(val data: FrozenMap) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(3.0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidation1BoxedList>, MapSchemaValidator, MaximumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidation1BoxedVoid { + return MaximumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidation1BoxedBoolean { + return MaximumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidation1BoxedNumber { + return MaximumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidation1BoxedString { + return MaximumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidation1BoxedList { + return MaximumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidation1BoxedMap { + return MaximumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt new file mode 100644 index 00000000000..49da0ee99a0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidationWithUnsignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidationWithUnsignedInteger1Boxed { + fun getData(): Any? + } + + data class MaximumValidationWithUnsignedInteger1BoxedVoid(val data: Nothing?) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedBoolean(val data: Boolean): MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedNumber(val data: Number) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedString(val data: String) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedList(val data: FrozenList) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedMap(val data: FrozenMap) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidationWithUnsignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(300) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedList>, MapSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidationWithUnsignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidationWithUnsignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedVoid { + return MaximumValidationWithUnsignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedBoolean { + return MaximumValidationWithUnsignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedNumber { + return MaximumValidationWithUnsignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedString { + return MaximumValidationWithUnsignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedList { + return MaximumValidationWithUnsignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedMap { + return MaximumValidationWithUnsignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt new file mode 100644 index 00000000000..1f763f7719f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxitemsValidation1Boxed { + fun getData(): Any? + } + + data class MaxitemsValidation1BoxedVoid(val data: Nothing?) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedBoolean(val data: Boolean): MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedNumber(val data: Number) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedString(val data: String) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedList(val data: FrozenList) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedMap(val data: FrozenMap) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxItems(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxitemsValidation1BoxedList>, MapSchemaValidator, MaxitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedVoid { + return MaxitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedBoolean { + return MaxitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedNumber { + return MaxitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedString { + return MaxitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedList { + return MaxitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedMap { + return MaxitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt new file mode 100644 index 00000000000..ba1e070bc6f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxlengthValidation1Boxed { + fun getData(): Any? + } + + data class MaxlengthValidation1BoxedVoid(val data: Nothing?) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedBoolean(val data: Boolean): MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedNumber(val data: Number) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedString(val data: String) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedList(val data: FrozenList) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedMap(val data: FrozenMap) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxlengthValidation1BoxedList>, MapSchemaValidator, MaxlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedVoid { + return MaxlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedBoolean { + return MaxlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedNumber { + return MaxlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedString { + return MaxlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedList { + return MaxlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedMap { + return MaxlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt new file mode 100644 index 00000000000..62b6deb1e2e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Maxproperties0MeansTheObjectIsEmpty { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed { + fun getData(): Any? + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(val data: Nothing?) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(val data: Boolean): Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(val data: Number) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedString(val data: String) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedList(val data: FrozenList) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap(val data: FrozenMap) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Maxproperties0MeansTheObjectIsEmpty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedList>, MapSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Maxproperties0MeansTheObjectIsEmpty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Maxproperties0MeansTheObjectIsEmpty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedVoid { + return Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean { + return Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedNumber { + return Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedString { + return Maxproperties0MeansTheObjectIsEmpty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedList { + return Maxproperties0MeansTheObjectIsEmpty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedMap { + return Maxproperties0MeansTheObjectIsEmpty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt new file mode 100644 index 00000000000..4605f17fd0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MaxpropertiesValidation1BoxedVoid(val data: Nothing?) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedBoolean(val data: Boolean): MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedNumber(val data: Number) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedString(val data: String) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedList(val data: FrozenList) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedMap(val data: FrozenMap) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxpropertiesValidation1BoxedList>, MapSchemaValidator, MaxpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedVoid { + return MaxpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedBoolean { + return MaxpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedNumber { + return MaxpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedString { + return MaxpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedList { + return MaxpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedMap { + return MaxpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt new file mode 100644 index 00000000000..93c46043a0f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidation1Boxed { + fun getData(): Any? + } + + data class MinimumValidation1BoxedVoid(val data: Nothing?) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedBoolean(val data: Boolean): MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedNumber(val data: Number) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedString(val data: String) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedList(val data: FrozenList) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedMap(val data: FrozenMap) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(1.1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidation1BoxedList>, MapSchemaValidator, MinimumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidation1BoxedVoid { + return MinimumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidation1BoxedBoolean { + return MinimumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidation1BoxedNumber { + return MinimumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidation1BoxedString { + return MinimumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidation1BoxedList { + return MinimumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidation1BoxedMap { + return MinimumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt new file mode 100644 index 00000000000..d6d1593b716 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidationWithSignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidationWithSignedInteger1Boxed { + fun getData(): Any? + } + + data class MinimumValidationWithSignedInteger1BoxedVoid(val data: Nothing?) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedBoolean(val data: Boolean): MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedNumber(val data: Number) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedString(val data: String) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedList(val data: FrozenList) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedMap(val data: FrozenMap) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidationWithSignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidationWithSignedInteger1BoxedList>, MapSchemaValidator, MinimumValidationWithSignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidationWithSignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidationWithSignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedVoid { + return MinimumValidationWithSignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedBoolean { + return MinimumValidationWithSignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedNumber { + return MinimumValidationWithSignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedString { + return MinimumValidationWithSignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedList { + return MinimumValidationWithSignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedMap { + return MinimumValidationWithSignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt new file mode 100644 index 00000000000..bc2ce6d4c65 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinitemsValidation1Boxed { + fun getData(): Any? + } + + data class MinitemsValidation1BoxedVoid(val data: Nothing?) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedBoolean(val data: Boolean): MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedNumber(val data: Number) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedString(val data: String) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedList(val data: FrozenList) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedMap(val data: FrozenMap) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minItems(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinitemsValidation1BoxedList>, MapSchemaValidator, MinitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinitemsValidation1BoxedVoid { + return MinitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinitemsValidation1BoxedBoolean { + return MinitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinitemsValidation1BoxedNumber { + return MinitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinitemsValidation1BoxedString { + return MinitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedList { + return MinitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedMap { + return MinitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt new file mode 100644 index 00000000000..2e7b4c422ee --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinlengthValidation1Boxed { + fun getData(): Any? + } + + data class MinlengthValidation1BoxedVoid(val data: Nothing?) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedBoolean(val data: Boolean): MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedNumber(val data: Number) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedString(val data: String) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedList(val data: FrozenList) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedMap(val data: FrozenMap) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinlengthValidation1BoxedList>, MapSchemaValidator, MinlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinlengthValidation1BoxedVoid { + return MinlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinlengthValidation1BoxedBoolean { + return MinlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinlengthValidation1BoxedNumber { + return MinlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinlengthValidation1BoxedString { + return MinlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedList { + return MinlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedMap { + return MinlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt new file mode 100644 index 00000000000..bb29435be31 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MinpropertiesValidation1BoxedVoid(val data: Nothing?) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedBoolean(val data: Boolean): MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedNumber(val data: Number) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedString(val data: String) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedList(val data: FrozenList) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedMap(val data: FrozenMap) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minProperties(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinpropertiesValidation1BoxedList>, MapSchemaValidator, MinpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedVoid { + return MinpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedBoolean { + return MinpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedNumber { + return MinpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedString { + return MinpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedList { + return MinpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedMap { + return MinpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..d2e2c14ae94 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAllofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAllofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAllofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedString(val data: String) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAllofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAllofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAllofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedVoid { + return NestedAllofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedBoolean { + return NestedAllofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedNumber { + return NestedAllofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedString { + return NestedAllofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedList { + return NestedAllofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedMap { + return NestedAllofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..df6ba63b7b6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAnyofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAnyofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAnyofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedString(val data: String) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAnyofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAnyofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAnyofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedVoid { + return NestedAnyofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedBoolean { + return NestedAnyofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedNumber { + return NestedAnyofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedString { + return NestedAnyofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedList { + return NestedAnyofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedMap { + return NestedAnyofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt new file mode 100644 index 00000000000..27acba2e66d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt @@ -0,0 +1,510 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedItems { + // nest classes so all schemas and input/output classes can be public + + + class Items3 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Items3? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items3().also { instance = it } + } + } + } + + + class ItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsList { + return Items2.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface Items2Boxed { + fun getData(): Any? + } + + data class Items2BoxedList(val data: ItemsList) : Items2Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items2 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items3::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items2().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Number)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items2BoxedList { + return Items2BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items2Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList1(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>, configuration: SchemaConfiguration?): ItemsList1 { + return Items1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder1 { + // class to build List> + private val list: MutableList> + + init { + this.list = ArrayList() + } + + + fun add(item: List): ItemsListBuilder1 { + list.add(item) + return this + } + + fun build(): List> { + return list + } + } + + + sealed interface Items1Boxed { + fun getData(): Any? + } + + data class Items1BoxedList(val data: ItemsList1) : Items1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items2::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList1 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList1(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList1 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items1BoxedList { + return Items1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList2(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>, configuration: SchemaConfiguration?): ItemsList2 { + return Items.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder2 { + // class to build List>> + private val list: MutableList>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>): ItemsListBuilder2 { + list.add(item) + return this + } + + fun build(): List>> { + return list + } + } + + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedList(val data: ItemsList2) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items1::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList2 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList1)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList2(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList2 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class NestedItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>>, configuration: SchemaConfiguration?): NestedItemsList { + return NestedItems1.getInstance().validate(arg, configuration) + } + } + } + + class NestedItemsListBuilder { + // class to build List>>> + private val list: MutableList>>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>>): NestedItemsListBuilder { + list.add(item) + return this + } + + fun build(): List>>> { + return list + } + } + + + sealed interface NestedItems1Boxed { + fun getData(): Any? + } + + data class NestedItems1BoxedList(val data: NestedItemsList) : NestedItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NestedItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): NestedItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList2)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return NestedItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): NestedItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedItems1BoxedList { + return NestedItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..eaaadf832d1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedOneofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedOneofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedOneofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedString(val data: String) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedOneofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedOneofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedOneofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedVoid { + return NestedOneofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedBoolean { + return NestedOneofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedNumber { + return NestedOneofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedString { + return NestedOneofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedList { + return NestedOneofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedMap { + return NestedOneofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt new file mode 100644 index 00000000000..96a1a64a1be --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Not { + // nest classes so all schemas and input/output classes can be public + + + class Not2 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Not2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not2().also { instance = it } + } + } + } + + + sealed interface Not1Boxed { + fun getData(): Any? + } + + data class Not1BoxedVoid(val data: Nothing?) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedBoolean(val data: Boolean): Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedNumber(val data: Number) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedString(val data: String) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedList(val data: FrozenList) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedMap(val data: FrozenMap) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Not1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not2::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Not1BoxedList>, MapSchemaValidator, Not1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Not1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Not1BoxedVoid { + return Not1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Not1BoxedBoolean { + return Not1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Not1BoxedNumber { + return Not1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Not1BoxedString { + return Not1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Not1BoxedList { + return Not1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Not1BoxedMap { + return Not1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Not1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt new file mode 100644 index 00000000000..70fae92a396 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt @@ -0,0 +1,478 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NotMoreComplexSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class NotMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): NotMap { + return Not.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class NotMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): NotMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): NotMapBuilder { + return this + } + } + + + sealed interface NotBoxed { + fun getData(): Any? + } + + data class NotBoxedMap(val data: NotMap) : NotBoxed { + override fun getData(): Any? { + return data + } + } + + + class Not private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java + )) + ), MapSchemaValidator { + + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): NotMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return NotMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotBoxedMap { + return NotBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotBoxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + + sealed interface NotMoreComplexSchema1Boxed { + fun getData(): Any? + } + + data class NotMoreComplexSchema1BoxedVoid(val data: Nothing?) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedBoolean(val data: Boolean): NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedNumber(val data: Number) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedString(val data: String) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedList(val data: FrozenList) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedMap(val data: FrozenMap) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NotMoreComplexSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotMoreComplexSchema1BoxedList>, MapSchemaValidator, NotMoreComplexSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NotMoreComplexSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NotMoreComplexSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedVoid { + return NotMoreComplexSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedBoolean { + return NotMoreComplexSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedNumber { + return NotMoreComplexSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedString { + return NotMoreComplexSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedList { + return NotMoreComplexSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedMap { + return NotMoreComplexSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotMoreComplexSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt new file mode 100644 index 00000000000..4117850d7fd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt @@ -0,0 +1,104 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NulCharactersInStrings { + // nest classes so all schemas and input/output classes can be public + + enum class StringNulCharactersInStringsEnums(private val value: String): StringValueMethod { + HELLO_NULL_THERE("hello\u0000there"); + + override fun value(): String { + return this.value + } + } + + + sealed interface NulCharactersInStrings1Boxed { + fun getData(): Any? + } + + data class NulCharactersInStrings1BoxedString(val data: String) : NulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NulCharactersInStrings1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "hello\u0000there" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NulCharactersInStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NulCharactersInStrings1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringNulCharactersInStringsEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NulCharactersInStrings1BoxedString { + return NulCharactersInStrings1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NulCharactersInStrings1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt new file mode 100644 index 00000000000..d4dfe771cb3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NullJsonSchema + +class NullTypeMatchesOnlyTheNullObject: NullJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NullTypeMatchesOnlyTheNullObject1 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: NullTypeMatchesOnlyTheNullObject1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullTypeMatchesOnlyTheNullObject1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt new file mode 100644 index 00000000000..6cd4a213c71 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NumberJsonSchema + +class NumberTypeMatchesNumbers: NumberJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NumberTypeMatchesNumbers1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: NumberTypeMatchesNumbers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberTypeMatchesNumbers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt new file mode 100644 index 00000000000..9eaf12687f3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt @@ -0,0 +1,453 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ObjectPropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class ObjectPropertiesValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ObjectPropertiesValidationMap { + return ObjectPropertiesValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Number { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): String { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class ObjectPropertiesValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + } + + + sealed interface ObjectPropertiesValidation1Boxed { + fun getData(): Any? + } + + data class ObjectPropertiesValidation1BoxedVoid(val data: Nothing?) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedBoolean(val data: Boolean): ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedNumber(val data: Number) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedString(val data: String) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedList(val data: FrozenList) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedMap(val data: ObjectPropertiesValidationMap) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ObjectPropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ObjectPropertiesValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ObjectPropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectPropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ObjectPropertiesValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ObjectPropertiesValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedVoid { + return ObjectPropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedBoolean { + return ObjectPropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedNumber { + return ObjectPropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedString { + return ObjectPropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedList { + return ObjectPropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedMap { + return ObjectPropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt new file mode 100644 index 00000000000..0cb08cb0b8f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +class ObjectTypeMatchesObjects: MapJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class ObjectTypeMatchesObjects1 : MapJsonSchema.MapJsonSchema1() { + companion object { + @Volatile + private var instance: ObjectTypeMatchesObjects1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectTypeMatchesObjects1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt new file mode 100644 index 00000000000..a3ca5e860ba --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Oneof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Oneof1Boxed { + fun getData(): Any? + } + + data class Oneof1BoxedVoid(val data: Nothing?) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedBoolean(val data: Boolean): Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedNumber(val data: Number) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedString(val data: String) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedList(val data: FrozenList) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedMap(val data: FrozenMap) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Oneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Oneof1BoxedList>, MapSchemaValidator, Oneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Oneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Oneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Oneof1BoxedVoid { + return Oneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Oneof1BoxedBoolean { + return Oneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Oneof1BoxedNumber { + return Oneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Oneof1BoxedString { + return Oneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Oneof1BoxedList { + return Oneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Oneof1BoxedMap { + return Oneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Oneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt new file mode 100644 index 00000000000..0810d902fbb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofComplexTypes1Boxed { + fun getData(): Any? + } + + data class OneofComplexTypes1BoxedVoid(val data: Nothing?) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedBoolean(val data: Boolean): OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedNumber(val data: Number) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedString(val data: String) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedList(val data: FrozenList) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedMap(val data: FrozenMap) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofComplexTypes1BoxedList>, MapSchemaValidator, OneofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedVoid { + return OneofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedBoolean { + return OneofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedNumber { + return OneofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedString { + return OneofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedList { + return OneofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedMap { + return OneofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt new file mode 100644 index 00000000000..d82112c6547 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class OneofWithBaseSchema1BoxedString(val data: String) : OneofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class OneofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithBaseSchema1BoxedString { + return OneofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt new file mode 100644 index 00000000000..06241abdcdd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface OneofWithEmptySchema1Boxed { + fun getData(): Any? + } + + data class OneofWithEmptySchema1BoxedVoid(val data: Nothing?) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedBoolean(val data: Boolean): OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedNumber(val data: Number) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedString(val data: String) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedList(val data: FrozenList) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedMap(val data: FrozenMap) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofWithEmptySchema1BoxedList>, MapSchemaValidator, OneofWithEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedVoid { + return OneofWithEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedBoolean { + return OneofWithEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedNumber { + return OneofWithEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedString { + return OneofWithEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedList { + return OneofWithEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedMap { + return OneofWithEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt new file mode 100644 index 00000000000..163cebccec9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt @@ -0,0 +1,1096 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithRequired { + // nest classes so all schemas and input/output classes can be public + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map00Builder { + return this + } + } + + class Schema0Map01Builder(private val instance: MutableMap): SetterForFoo { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0Map10Builder(private val instance: MutableMap): SetterForBar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0MapBuilder: SetterForBar, SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map01Builder { + return Schema0Map01Builder(instance) + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map10Builder { + return Schema0Map10Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "bar", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + + fun baz(value: Boolean): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: String): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Int): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Float): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Long): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Double): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: List): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Map): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + } + + interface SetterForFoo1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoo1(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + } + + class Schema1Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map00Builder { + return this + } + } + + class Schema1Map01Builder(private val instance: MutableMap): SetterForFoo1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1Map10Builder(private val instance: MutableMap): SetterForBaz { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1MapBuilder: SetterForBaz, SetterForFoo1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map01Builder { + return Schema1Map01Builder(instance) + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map10Builder { + return Schema1Map10Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "baz", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithRequired1Boxed { + fun getData(): Any? + } + + data class OneofWithRequired1BoxedMap(val data: FrozenMap) : OneofWithRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithRequired1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), MapSchemaValidator, OneofWithRequired1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithRequired1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithRequired1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithRequired1BoxedMap { + return OneofWithRequired1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithRequired1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt new file mode 100644 index 00000000000..187e8f7823f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternIsNotAnchored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternIsNotAnchored1Boxed { + fun getData(): Any? + } + + data class PatternIsNotAnchored1BoxedVoid(val data: Nothing?) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedBoolean(val data: Boolean): PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedNumber(val data: Number) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedString(val data: String) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedList(val data: FrozenList) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedMap(val data: FrozenMap) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternIsNotAnchored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "a+" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternIsNotAnchored1BoxedList>, MapSchemaValidator, PatternIsNotAnchored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternIsNotAnchored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternIsNotAnchored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedVoid { + return PatternIsNotAnchored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedBoolean { + return PatternIsNotAnchored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedNumber { + return PatternIsNotAnchored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedString { + return PatternIsNotAnchored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedList { + return PatternIsNotAnchored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedMap { + return PatternIsNotAnchored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternIsNotAnchored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt new file mode 100644 index 00000000000..3d58fd45c4a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternValidation1Boxed { + fun getData(): Any? + } + + data class PatternValidation1BoxedVoid(val data: Nothing?) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedBoolean(val data: Boolean): PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedNumber(val data: Number) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedString(val data: String) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedList(val data: FrozenList) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedMap(val data: FrozenMap) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "^a*\$" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternValidation1BoxedList>, MapSchemaValidator, PatternValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternValidation1BoxedVoid { + return PatternValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternValidation1BoxedBoolean { + return PatternValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternValidation1BoxedNumber { + return PatternValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternValidation1BoxedString { + return PatternValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternValidation1BoxedList { + return PatternValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternValidation1BoxedMap { + return PatternValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt new file mode 100644 index 00000000000..14863b15c8a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt @@ -0,0 +1,640 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class Foonbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foonbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foonbar().also { instance = it } + } + } + } + + + class Foobar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar().also { instance = it } + } + } + } + + + class Foobar1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar1().also { instance = it } + } + } + } + + + class Foorbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foorbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foorbar().also { instance = it } + } + } + } + + + class Footbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Footbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Footbar().also { instance = it } + } + } + } + + + class Foou000Cbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foou000Cbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foou000Cbar().also { instance = it } + } + } + } + + + class PropertiesWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWithEscapedCharactersMap { + return PropertiesWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + class PropertiesWithEscapedCharactersMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoonbar, SetterForFoobar, SetterForFoobar1, SetterForFoorbar, SetterForFootbar, SetterForFoou000Cbar { + private val knownKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar1(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoorbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFootbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + } + + + sealed interface PropertiesWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class PropertiesWithEscapedCharacters1BoxedVoid(val data: Nothing?) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedBoolean(val data: Boolean): PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedNumber(val data: Number) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedString(val data: String) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedList(val data: FrozenList) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedMap(val data: PropertiesWithEscapedCharactersMap) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo\nbar" to Foonbar::class.java, + "foo\"bar" to Foobar::class.java, + "foo\\bar" to Foobar1::class.java, + "foo\rbar" to Foorbar::class.java, + "foo\tbar" to Footbar::class.java, + "foo\u000Cbar" to Foou000Cbar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedVoid { + return PropertiesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedBoolean { + return PropertiesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedNumber { + return PropertiesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedString { + return PropertiesWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedList { + return PropertiesWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedMap { + return PropertiesWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt new file mode 100644 index 00000000000..7517a23585e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt @@ -0,0 +1,382 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertyNamedRefThatIsNotAReference { + // nest classes so all schemas and input/output classes can be public + + + class Ref : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Ref? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ref().also { instance = it } + } + } + } + + + class PropertyNamedRefThatIsNotAReferenceMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "\$ref" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertyNamedRefThatIsNotAReferenceMap { + return PropertyNamedRefThatIsNotAReference1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForRef { + fun getInstance(): MutableMap + fun getBuilderAfterRef(instance: MutableMap): T + + fun reverseSolidusDollarSignRef(value: String): T { + val instance = getInstance() + instance["\$ref"] = value + return getBuilderAfterRef(instance) + } + } + + class PropertyNamedRefThatIsNotAReferenceMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForRef { + private val knownKeys: Set = setOf( + "\$ref" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterRef(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + } + + + sealed interface PropertyNamedRefThatIsNotAReference1Boxed { + fun getData(): Any? + } + + data class PropertyNamedRefThatIsNotAReference1BoxedVoid(val data: Nothing?) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedBoolean(val data: Boolean): PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedNumber(val data: Number) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedString(val data: String) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedList(val data: FrozenList) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedMap(val data: PropertyNamedRefThatIsNotAReferenceMap) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertyNamedRefThatIsNotAReference1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "\$ref" to Ref::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertyNamedRefThatIsNotAReference1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertyNamedRefThatIsNotAReference1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNamedRefThatIsNotAReference1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertyNamedRefThatIsNotAReferenceMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertyNamedRefThatIsNotAReferenceMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReferenceMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedVoid { + return PropertyNamedRefThatIsNotAReference1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedBoolean { + return PropertyNamedRefThatIsNotAReference1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedNumber { + return PropertyNamedRefThatIsNotAReference1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedString { + return PropertyNamedRefThatIsNotAReference1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedList { + return PropertyNamedRefThatIsNotAReference1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedMap { + return PropertyNamedRefThatIsNotAReference1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt new file mode 100644 index 00000000000..82108cf82fc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalproperties.kt @@ -0,0 +1,228 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInAdditionalproperties { + // nest classes so all schemas and input/output classes can be public + + + class RefInAdditionalpropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RefInAdditionalpropertiesMap { + return RefInAdditionalproperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + return getOrThrow(name) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class RefInAdditionalpropertiesMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RefInAdditionalpropertiesMapBuilder { + return this + } + } + + + sealed interface RefInAdditionalproperties1Boxed { + fun getData(): Any? + } + + data class RefInAdditionalproperties1BoxedMap(val data: RefInAdditionalpropertiesMap) : RefInAdditionalproperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInAdditionalproperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInAdditionalproperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInAdditionalproperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RefInAdditionalpropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Any?)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RefInAdditionalpropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAdditionalpropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAdditionalproperties1BoxedMap { + return RefInAdditionalproperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInAdditionalproperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt new file mode 100644 index 00000000000..74d68db3075 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllof.kt @@ -0,0 +1,310 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInAllof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInAllof1Boxed { + fun getData(): Any? + } + + data class RefInAllof1BoxedVoid(val data: Nothing?) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedBoolean(val data: Boolean): RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedNumber(val data: Number) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedString(val data: String) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedList(val data: FrozenList) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAllof1BoxedMap(val data: FrozenMap) : RefInAllof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInAllof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInAllof1BoxedList>, MapSchemaValidator, RefInAllof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInAllof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInAllof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInAllof1BoxedVoid { + return RefInAllof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInAllof1BoxedBoolean { + return RefInAllof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInAllof1BoxedNumber { + return RefInAllof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInAllof1BoxedString { + return RefInAllof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInAllof1BoxedList { + return RefInAllof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAllof1BoxedMap { + return RefInAllof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInAllof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt new file mode 100644 index 00000000000..bdd6d0a4e7b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyof.kt @@ -0,0 +1,310 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInAnyof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInAnyof1Boxed { + fun getData(): Any? + } + + data class RefInAnyof1BoxedVoid(val data: Nothing?) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedBoolean(val data: Boolean): RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedNumber(val data: Number) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedString(val data: String) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedList(val data: FrozenList) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInAnyof1BoxedMap(val data: FrozenMap) : RefInAnyof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInAnyof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInAnyof1BoxedList>, MapSchemaValidator, RefInAnyof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInAnyof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInAnyof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInAnyof1BoxedVoid { + return RefInAnyof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInAnyof1BoxedBoolean { + return RefInAnyof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInAnyof1BoxedNumber { + return RefInAnyof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInAnyof1BoxedString { + return RefInAnyof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInAnyof1BoxedList { + return RefInAnyof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInAnyof1BoxedMap { + return RefInAnyof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInAnyof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt new file mode 100644 index 00000000000..f56ab91e736 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInItems.kt @@ -0,0 +1,176 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInItems { + // nest classes so all schemas and input/output classes can be public + + + class RefInItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): RefInItemsList { + return RefInItems1.getInstance().validate(arg, configuration) + } + } + } + + class RefInItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): RefInItemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): RefInItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): RefInItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface RefInItems1Boxed { + fun getData(): Any? + } + + data class RefInItems1BoxedList(val data: RefInItemsList) : RefInItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class RefInItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): RefInItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Any?)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return RefInItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): RefInItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInItems1BoxedList { + return RefInItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt new file mode 100644 index 00000000000..29756f7c1e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInNot.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInNot { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInNot1Boxed { + fun getData(): Any? + } + + data class RefInNot1BoxedVoid(val data: Nothing?) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedBoolean(val data: Boolean): RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedNumber(val data: Number) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedString(val data: String) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedList(val data: FrozenList) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInNot1BoxedMap(val data: FrozenMap) : RefInNot1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInNot1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInNot1BoxedList>, MapSchemaValidator, RefInNot1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInNot1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInNot1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInNot1BoxedVoid { + return RefInNot1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInNot1BoxedBoolean { + return RefInNot1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInNot1BoxedNumber { + return RefInNot1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInNot1BoxedString { + return RefInNot1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInNot1BoxedList { + return RefInNot1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInNot1BoxedMap { + return RefInNot1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInNot1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt new file mode 100644 index 00000000000..cdb1ab0443f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneof.kt @@ -0,0 +1,310 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInOneof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RefInOneof1Boxed { + fun getData(): Any? + } + + data class RefInOneof1BoxedVoid(val data: Nothing?) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedBoolean(val data: Boolean): RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedNumber(val data: Number) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedString(val data: String) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedList(val data: FrozenList) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInOneof1BoxedMap(val data: FrozenMap) : RefInOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInOneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInOneof1BoxedList>, MapSchemaValidator, RefInOneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInOneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInOneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInOneof1BoxedVoid { + return RefInOneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInOneof1BoxedBoolean { + return RefInOneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInOneof1BoxedNumber { + return RefInOneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInOneof1BoxedString { + return RefInOneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInOneof1BoxedList { + return RefInOneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInOneof1BoxedMap { + return RefInOneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInOneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt new file mode 100644 index 00000000000..d914b13af1d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RefInProperty.kt @@ -0,0 +1,427 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RefInProperty { + // nest classes so all schemas and input/output classes can be public + + + class RefInPropertyMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "a" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RefInPropertyMap { + return RefInProperty1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun a(): Any? { + val key = "a" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Any?)) { + throw RuntimeException("Invalid value stored for a") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForA { + fun getInstance(): MutableMap + fun getBuilderAfterA(instance: MutableMap): T + + fun a(value: Nothing?): T { + val instance = getInstance() + instance["a"] = null + return getBuilderAfterA(instance) + } + + fun a(value: Boolean): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: String): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Int): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Float): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Long): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Double): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: List): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + + fun a(value: Map): T { + val instance = getInstance() + instance["a"] = value + return getBuilderAfterA(instance) + } + } + + class RefInPropertyMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForA { + private val knownKeys: Set = setOf( + "a" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterA(instance: MutableMap): RefInPropertyMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RefInPropertyMapBuilder { + return this + } + } + + + sealed interface RefInProperty1Boxed { + fun getData(): Any? + } + + data class RefInProperty1BoxedVoid(val data: Nothing?) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedBoolean(val data: Boolean): RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedNumber(val data: Number) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedString(val data: String) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedList(val data: FrozenList) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RefInProperty1BoxedMap(val data: RefInPropertyMap) : RefInProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RefInProperty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "a" to PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RefInProperty1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RefInProperty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefInProperty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RefInPropertyMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RefInPropertyMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInPropertyMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RefInProperty1BoxedVoid { + return RefInProperty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RefInProperty1BoxedBoolean { + return RefInProperty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RefInProperty1BoxedNumber { + return RefInProperty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RefInProperty1BoxedString { + return RefInProperty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RefInProperty1BoxedList { + return RefInProperty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RefInProperty1BoxedMap { + return RefInProperty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RefInProperty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt new file mode 100644 index 00000000000..5774da81ccc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredDefaultValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredDefaultValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredDefaultValidationMap { + return RequiredDefaultValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredDefaultValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + } + + + sealed interface RequiredDefaultValidation1Boxed { + fun getData(): Any? + } + + data class RequiredDefaultValidation1BoxedVoid(val data: Nothing?) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedBoolean(val data: Boolean): RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedNumber(val data: Number) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedString(val data: String) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedList(val data: FrozenList) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedMap(val data: RequiredDefaultValidationMap) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredDefaultValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredDefaultValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredDefaultValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredDefaultValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredDefaultValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredDefaultValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedVoid { + return RequiredDefaultValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedBoolean { + return RequiredDefaultValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedNumber { + return RequiredDefaultValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedString { + return RequiredDefaultValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedList { + return RequiredDefaultValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedMap { + return RequiredDefaultValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredDefaultValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt new file mode 100644 index 00000000000..1ff4bb0d707 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt @@ -0,0 +1,531 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class RequiredValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredValidationMap { + return RequiredValidation1.getInstance().validate(arg, configuration) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class RequiredValidationMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + } + + class RequiredValidationMapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredValidationMap0Builder { + return RequiredValidationMap0Builder(instance) + } + } + + + sealed interface RequiredValidation1Boxed { + fun getData(): Any? + } + + data class RequiredValidation1BoxedVoid(val data: Nothing?) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedBoolean(val data: Boolean): RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedNumber(val data: Number) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedString(val data: String) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedList(val data: FrozenList) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedMap(val data: RequiredValidationMap) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredValidation1BoxedVoid { + return RequiredValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredValidation1BoxedBoolean { + return RequiredValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredValidation1BoxedNumber { + return RequiredValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredValidation1BoxedString { + return RequiredValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredValidation1BoxedList { + return RequiredValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidation1BoxedMap { + return RequiredValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt new file mode 100644 index 00000000000..d8eaca1b1e1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEmptyArray { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredWithEmptyArrayMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEmptyArrayMap { + return RequiredWithEmptyArray1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredWithEmptyArrayMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + } + + + sealed interface RequiredWithEmptyArray1Boxed { + fun getData(): Any? + } + + data class RequiredWithEmptyArray1BoxedVoid(val data: Nothing?) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedBoolean(val data: Boolean): RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedNumber(val data: Number) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedString(val data: String) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedList(val data: FrozenList) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedMap(val data: RequiredWithEmptyArrayMap) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEmptyArray1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEmptyArray1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEmptyArray1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEmptyArray1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEmptyArrayMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEmptyArrayMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArrayMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedVoid { + return RequiredWithEmptyArray1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedBoolean { + return RequiredWithEmptyArray1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedNumber { + return RequiredWithEmptyArray1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedString { + return RequiredWithEmptyArray1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedList { + return RequiredWithEmptyArray1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedMap { + return RequiredWithEmptyArray1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt new file mode 100644 index 00000000000..872c5f93243 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt @@ -0,0 +1,1677 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class RequiredWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEscapedCharactersMap { + return RequiredWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\tbar"] = null + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Boolean): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: String): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: List): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Map): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\nbar"] = null + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Boolean): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: String): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: List): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Map): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\u000Cbar"] = null + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Boolean): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: String): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: List): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Map): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\rbar"] = null + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Boolean): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: String): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: List): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Map): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\"bar"] = null + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Boolean): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: String): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: List): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Map): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\\bar"] = null + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Boolean): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: String): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: List): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Map): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + class RequiredWithEscapedCharactersMap000000Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return this + } + } + + class RequiredWithEscapedCharactersMap000001Builder(private val instance: MutableMap): SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000010Builder(private val instance: MutableMap): SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000011Builder(private val instance: MutableMap): SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000100Builder(private val instance: MutableMap): SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000101Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000110Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000111Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001000Builder(private val instance: MutableMap): SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001001Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001010Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001011Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001100Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001101Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001110Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001111Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010000Builder(private val instance: MutableMap): SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011000Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100000Builder(private val instance: MutableMap): SetterForFootbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMapBuilder: SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011111Builder { + return RequiredWithEscapedCharactersMap011111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101111Builder { + return RequiredWithEscapedCharactersMap101111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110111Builder { + return RequiredWithEscapedCharactersMap110111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111011Builder { + return RequiredWithEscapedCharactersMap111011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111101Builder { + return RequiredWithEscapedCharactersMap111101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111110Builder { + return RequiredWithEscapedCharactersMap111110Builder(instance) + } + } + + + sealed interface RequiredWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class RequiredWithEscapedCharacters1BoxedVoid(val data: Nothing?) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedBoolean(val data: Boolean): RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedNumber(val data: Number) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedString(val data: String) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedList(val data: FrozenList) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedMap(val data: RequiredWithEscapedCharactersMap) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedVoid { + return RequiredWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedBoolean { + return RequiredWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedNumber { + return RequiredWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedString { + return RequiredWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedList { + return RequiredWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedMap { + return RequiredWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt new file mode 100644 index 00000000000..6a6008202bc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SimpleEnumValidation { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerSimpleEnumValidationEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1), + POSITIVE_2(2), + POSITIVE_3(3); + + override fun value(): Int { + return this.value + } + } + + enum class LongSimpleEnumValidationEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L), + POSITIVE_2(2L), + POSITIVE_3(3L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatSimpleEnumValidationEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f), + POSITIVE_2(2.0f), + POSITIVE_3(3.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleSimpleEnumValidationEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0), + POSITIVE_2(2.0), + POSITIVE_3(3.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface SimpleEnumValidation1Boxed { + fun getData(): Any? + } + + data class SimpleEnumValidation1BoxedNumber(val data: Number) : SimpleEnumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class SimpleEnumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1"), + BigDecimal("2"), + BigDecimal("3") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SimpleEnumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SimpleEnumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SimpleEnumValidation1BoxedNumber { + return SimpleEnumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SimpleEnumValidation1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt new file mode 100644 index 00000000000..029fbdd5f39 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.StringJsonSchema + +class StringTypeMatchesStrings: StringJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class StringTypeMatchesStrings1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: StringTypeMatchesStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringTypeMatchesStrings1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt new file mode 100644 index 00000000000..299d099fc0b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.kt @@ -0,0 +1,291 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.DefaultValueMethod +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing { + // nest classes so all schemas and input/output classes can be public + + + sealed interface AlphaBoxed { + fun getData(): Any? + } + + data class AlphaBoxedNumber(val data: Number) : AlphaBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Alpha private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .maximum(3) + .defaultValue(5.0) + ), NumberSchemaValidator { + + companion object { + @Volatile + private var instance: Alpha? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Alpha().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AlphaBoxedNumber { + return AlphaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AlphaBoxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "alpha" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap { + return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun alpha(): Number { + val key = "alpha" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for alpha") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForAlpha { + fun getInstance(): MutableMap + fun getBuilderAfterAlpha(instance: MutableMap): T + + fun alpha(value: Int): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + + fun alpha(value: Float): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + + fun alpha(value: Long): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + + fun alpha(value: Double): T { + val instance = getInstance() + instance["alpha"] = value + return getBuilderAfterAlpha(instance) + } + } + + class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForAlpha { + private val knownKeys: Set = setOf( + "alpha" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAlpha(instance: MutableMap): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMapBuilder { + return this + } + } + + + sealed interface TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed { + fun getData(): Any? + } + + data class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap(val data: TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap) : TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed { + override fun getData(): Any? { + return data + } + } + + + class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "alpha" to Alpha::class.java + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap { + return TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt new file mode 100644 index 00000000000..525bbb087f7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsFalseValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsFalseValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsFalseValidation1BoxedVoid(val data: Nothing?) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedBoolean(val data: Boolean): UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedNumber(val data: Number) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedString(val data: String) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedList(val data: FrozenList) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedMap(val data: FrozenMap) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsFalseValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(false) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsFalseValidation1BoxedList>, MapSchemaValidator, UniqueitemsFalseValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsFalseValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsFalseValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedVoid { + return UniqueitemsFalseValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedBoolean { + return UniqueitemsFalseValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedNumber { + return UniqueitemsFalseValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedString { + return UniqueitemsFalseValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedList { + return UniqueitemsFalseValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedMap { + return UniqueitemsFalseValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt new file mode 100644 index 00000000000..181ba3a42b5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsValidation1BoxedVoid(val data: Nothing?) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedBoolean(val data: Boolean): UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedNumber(val data: Number) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedString(val data: String) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedList(val data: FrozenList) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedMap(val data: FrozenMap) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(true) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsValidation1BoxedList>, MapSchemaValidator, UniqueitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedVoid { + return UniqueitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedBoolean { + return UniqueitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedNumber { + return UniqueitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedString { + return UniqueitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedList { + return UniqueitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedMap { + return UniqueitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt new file mode 100644 index 00000000000..46a606e7c80 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriFormat1Boxed { + fun getData(): Any? + } + + data class UriFormat1BoxedVoid(val data: Nothing?) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedBoolean(val data: Boolean): UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedNumber(val data: Number) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedString(val data: String) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedList(val data: FrozenList) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedMap(val data: FrozenMap) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriFormat1BoxedList>, MapSchemaValidator, UriFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriFormat1BoxedVoid { + return UriFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriFormat1BoxedBoolean { + return UriFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriFormat1BoxedNumber { + return UriFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriFormat1BoxedString { + return UriFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriFormat1BoxedList { + return UriFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriFormat1BoxedMap { + return UriFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt new file mode 100644 index 00000000000..7bdbafd17e5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriReferenceFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriReferenceFormat1Boxed { + fun getData(): Any? + } + + data class UriReferenceFormat1BoxedVoid(val data: Nothing?) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedBoolean(val data: Boolean): UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedNumber(val data: Number) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedString(val data: String) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedList(val data: FrozenList) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedMap(val data: FrozenMap) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriReferenceFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-reference") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriReferenceFormat1BoxedList>, MapSchemaValidator, UriReferenceFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriReferenceFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriReferenceFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedVoid { + return UriReferenceFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedBoolean { + return UriReferenceFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedNumber { + return UriReferenceFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedString { + return UriReferenceFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedList { + return UriReferenceFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedMap { + return UriReferenceFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriReferenceFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt new file mode 100644 index 00000000000..6bfbac6b213 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriTemplateFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriTemplateFormat1Boxed { + fun getData(): Any? + } + + data class UriTemplateFormat1BoxedVoid(val data: Nothing?) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedBoolean(val data: Boolean): UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedNumber(val data: Number) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedString(val data: String) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedList(val data: FrozenList) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedMap(val data: FrozenMap) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriTemplateFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-template") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriTemplateFormat1BoxedList>, MapSchemaValidator, UriTemplateFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriTemplateFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriTemplateFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedVoid { + return UriTemplateFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedBoolean { + return UriTemplateFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedNumber { + return UriTemplateFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedString { + return UriTemplateFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedList { + return UriTemplateFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedMap { + return UriTemplateFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriTemplateFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt new file mode 100644 index 00000000000..93aa9a04917 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt @@ -0,0 +1,446 @@ +package org.openapijsonschematools.client.configurations; + +data class JsonSchemaKeywordFlags( + val additionalProperties: Boolean, + val allOf: Boolean, + val anyOf: Boolean, + val const_: Boolean, + val contains: Boolean, + val dependentRequired: Boolean, + val dependentSchemas: Boolean, + val discriminator: Boolean, + val else_: Boolean, + val enum_: Boolean, + val exclusiveMaximum: Boolean, + val exclusiveMinimum: Boolean, + val format: Boolean, + val if_: Boolean, + val maximum: Boolean, + val minimum: Boolean, + val items: Boolean, + val maxContains: Boolean, + val maxItems: Boolean, + val maxLength: Boolean, + val maxProperties: Boolean, + val minContains: Boolean, + val minItems: Boolean, + val minLength: Boolean, + val minProperties: Boolean, + val multipleOf: Boolean, + val not: Boolean, + val oneOf: Boolean, + val pattern: Boolean, + val patternProperties: Boolean, + val prefixItems: Boolean, + val properties: Boolean, + val propertyNames: Boolean, + val required: Boolean, + val then: Boolean, + val type: Boolean, + val uniqueItems: Boolean, + val unevaluatedItems: Boolean, + val unevaluatedProperties: Boolean +) { + val keywords: LinkedHashSet + get() { + val enabledKeywords = LinkedHashSet() + if (additionalProperties) { + enabledKeywords.add("additionalProperties") + } + if (allOf) { + enabledKeywords.add("allOf") + } + if (anyOf) { + enabledKeywords.add("anyOf") + } + if (const_) { + enabledKeywords.add("const") + } + if (contains) { + enabledKeywords.add("contains") + } + if (dependentRequired) { + enabledKeywords.add("dependentRequired") + } + if (dependentSchemas) { + enabledKeywords.add("dependentSchemas") + } + if (discriminator) { + enabledKeywords.add("discriminator") + } + if (else_) { + enabledKeywords.add("else_") + } + if (enum_) { + enabledKeywords.add("enum_") + } + if (exclusiveMaximum) { + enabledKeywords.add("exclusiveMaximum") + } + if (exclusiveMinimum) { + enabledKeywords.add("exclusiveMinimum") + } + if (format) { + enabledKeywords.add("format") + } + if (if_) { + enabledKeywords.add("if_") + } + if (maximum) { + enabledKeywords.add("maximum") + } + if (minimum) { + enabledKeywords.add("minimum") + } + if (items) { + enabledKeywords.add("items") + } + if (maxContains) { + enabledKeywords.add("maxContains") + } + if (maxItems) { + enabledKeywords.add("maxItems") + } + if (maxLength) { + enabledKeywords.add("maxLength") + } + if (maxProperties) { + enabledKeywords.add("maxProperties") + } + if (minContains) { + enabledKeywords.add("minContains") + } + if (minItems) { + enabledKeywords.add("minItems") + } + if (minLength) { + enabledKeywords.add("minLength") + } + if (minProperties) { + enabledKeywords.add("minProperties") + } + if (multipleOf) { + enabledKeywords.add("multipleOf") + } + if (not) { + enabledKeywords.add("not") + } + if (oneOf) { + enabledKeywords.add("oneOf") + } + if (pattern) { + enabledKeywords.add("pattern") + } + if (patternProperties) { + enabledKeywords.add("patternProperties") + } + if (prefixItems) { + enabledKeywords.add("prefixItems") + } + if (properties) { + enabledKeywords.add("properties") + } + if (propertyNames) { + enabledKeywords.add("propertyNames") + } + if (required) { + enabledKeywords.add("required") + } + if (then) { + enabledKeywords.add("then") + } + if (type) { + enabledKeywords.add("type") + } + if (uniqueItems) { + enabledKeywords.add("uniqueItems") + } + if (unevaluatedItems) { + enabledKeywords.add("unevaluatedItems") + } + if (unevaluatedProperties) { + enabledKeywords.add("unevaluatedProperties") + } + return enabledKeywords + } + + class Builder { + private var additionalProperties = false + private var allOf = false + private var anyOf = false + private var const_ = false + private var contains = false + private var dependentRequired = false + private var dependentSchemas = false + private var discriminator = false + private var else_ = false + private var enum_ = false + private var exclusiveMaximum = false + private var exclusiveMinimum = false + private var format = false + private var if_ = false + private var maximum = false + private var minimum = false + private var items = false + private var maxContains = false + private var maxItems = false + private var maxLength = false + private var maxProperties = false + private var minContains = false + private var minItems = false + private var minLength = false + private var minProperties = false + private var multipleOf = false + private var not = false + private var oneOf = false + private var pattern = false + private var patternProperties = false + private var prefixItems = false + private var properties = false + private var propertyNames = false + private var required = false + private var then = false + private var type = false + private var uniqueItems = false + private var unevaluatedItems = false + private var unevaluatedProperties = false + fun additionalProperties(): Builder { + additionalProperties = true + return this + } + + fun allOf(): Builder { + allOf = true + return this + } + + fun anyOf(): Builder { + anyOf = true + return this + } + + fun const_(): Builder { + const_ = true + return this + } + + fun contains(): Builder { + contains = true + return this + } + + fun dependentRequired(): Builder { + dependentRequired = true + return this + } + + fun dependentSchemas(): Builder { + dependentSchemas = true + return this + } + + fun discriminator(): Builder { + discriminator = true + return this + } + + fun else_(): Builder { + else_ = true + return this + } + + fun enum_(): Builder { + enum_ = true + return this + } + + fun exclusiveMaximum(): Builder { + exclusiveMaximum = true + return this + } + + fun exclusiveMinimum(): Builder { + exclusiveMinimum = true + return this + } + + fun format(): Builder { + format = true + return this + } + + fun if_(): Builder { + if_ = true + return this + } + + fun maximum(): Builder { + maximum = true + return this + } + + fun minimum(): Builder { + minimum = true + return this + } + + fun items(): Builder { + items = true + return this + } + + fun maxContains(): Builder { + maxContains = true + return this + } + + fun maxItems(): Builder { + maxItems = true + return this + } + + fun maxLength(): Builder { + maxLength = true + return this + } + + fun maxProperties(): Builder { + maxProperties = true + return this + } + + fun minContains(): Builder { + minContains = true + return this + } + + fun minItems(): Builder { + minItems = true + return this + } + + fun minLength(): Builder { + minLength = true + return this + } + + fun minProperties(): Builder { + minProperties = true + return this + } + + fun multipleOf(): Builder { + multipleOf = true + return this + } + + operator fun not(): Builder { + not = true + return this + } + + fun oneOf(): Builder { + oneOf = true + return this + } + + fun pattern(): Builder { + pattern = true + return this + } + + fun patternProperties(): Builder { + patternProperties = true + return this + } + + fun prefixItems(): Builder { + prefixItems = true + return this + } + + fun properties(): Builder { + properties = true + return this + } + + fun propertyNames(): Builder { + propertyNames = true + return this + } + + fun required(): Builder { + required = true + return this + } + + fun then(): Builder { + then = true + return this + } + + fun type(): Builder { + type = true + return this + } + + fun uniqueItems(): Builder { + uniqueItems = true + return this + } + + fun unevaluatedItems(): Builder { + unevaluatedItems = true + return this + } + + fun unevaluatedProperties(): Builder { + unevaluatedProperties = true + return this + } + + fun build(): JsonSchemaKeywordFlags { + return JsonSchemaKeywordFlags( + additionalProperties, + allOf, + anyOf, + const_, + contains, + dependentRequired, + dependentSchemas, + discriminator, + else_, + enum_, + exclusiveMaximum, + exclusiveMinimum, + format, + if_, + maximum, + minimum, + items, + maxContains, + maxItems, + maxLength, + maxProperties, + minContains, + minItems, + minLength, + minProperties, + multipleOf, + not, + oneOf, + pattern, + patternProperties, + prefixItems, + properties, + propertyNames, + required, + then, + type, + uniqueItems, + unevaluatedItems, + unevaluatedProperties + ) + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt new file mode 100644 index 00000000000..39a58bba52f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.configurations; + +data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt new file mode 100644 index 00000000000..90fd1cd37f1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt new file mode 100644 index 00000000000..ad5b703ba4e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class InvalidAdditionalPropertyException(s: String?) : BaseException(s) diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt new file mode 100644 index 00000000000..6bff93968fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt new file mode 100644 index 00000000000..f9ea00d0821 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class ValidationException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt new file mode 100644 index 00000000000..816976afa8f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt @@ -0,0 +1,358 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class AnyTypeJsonSchema { + sealed interface AnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class AnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class AnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, StringSchemaValidator, + ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedVoid { + return AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedBoolean { + return AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedNumber { + return AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedString { + return AnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedList { + return AnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedMap { + return AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: AnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt new file mode 100644 index 00000000000..ec466c5b84e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt @@ -0,0 +1,78 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class BooleanJsonSchema { + sealed interface BooleanJsonSchema1Boxed { + fun getData(): Any? + } + + data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class BooleanJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + ), BooleanSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Boolean { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BooleanJsonSchema1BoxedBoolean { + return BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BooleanJsonSchema1Boxed { + if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: BooleanJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt new file mode 100644 index 00000000000..ff7a15d365a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate + +open class DateJsonSchema { + sealed interface DateJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is LocalDate) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateJsonSchema1BoxedString { + return DateJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt new file mode 100644 index 00000000000..4da3ee275fe --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.ZonedDateTime + +open class DateTimeJsonSchema { + sealed interface DateTimeJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateTimeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date-time") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is ZonedDateTime) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeJsonSchema1BoxedString { + return DateTimeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateTimeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt new file mode 100644 index 00000000000..f327b015a82 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt @@ -0,0 +1,78 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class DecimalJsonSchema { + sealed interface DecimalJsonSchema1Boxed { + fun getData(): Any? + } + + data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DecimalJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("number") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DecimalJsonSchema1BoxedString { + return DecimalJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DecimalJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DecimalJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DecimalJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt new file mode 100644 index 00000000000..ac9981b8d46 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class DoubleJsonSchema { + sealed interface DoubleJsonSchema1Boxed { + fun getData(): Any? + } + + data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DoubleJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("double") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DoubleJsonSchema1BoxedNumber { + return DoubleJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DoubleJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DoubleJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DoubleJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt new file mode 100644 index 00000000000..016d1ef2e43 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class FloatJsonSchema { + sealed interface FloatJsonSchema1Boxed { + fun getData(): Any? + } + + data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class FloatJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Float::class.java + )) + .format("float") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatJsonSchema1BoxedNumber { + return FloatJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: FloatJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt new file mode 100644 index 00000000000..f96e858458c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas + +/** + * Builders must implement this class + * @param the type that the builder returns + */ +interface GenericBuilder { + fun build(): T +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt new file mode 100644 index 00000000000..fba8ab8762a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt @@ -0,0 +1,93 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class Int32JsonSchema { + sealed interface Int32JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int32JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Float::class.java + ) + ) + .format("int32") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int32JsonSchema1BoxedNumber { + return Int32JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int32JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int32JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int32JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt new file mode 100644 index 00000000000..8feda5d3694 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt @@ -0,0 +1,105 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class Int64JsonSchema { + sealed interface Int64JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int64JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int64") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int64JsonSchema1BoxedNumber { + return Int64JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int64JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int64JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int64JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt new file mode 100644 index 00000000000..0a0043e7335 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt @@ -0,0 +1,105 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class IntJsonSchema { + sealed interface IntJsonSchema1Boxed { + fun getData(): Any? + } + + data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class IntJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IntJsonSchema1BoxedNumber { + return IntJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IntJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: IntJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt new file mode 100644 index 00000000000..eff37e367ff --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class ListJsonSchema { + sealed interface ListJsonSchema1Boxed { + fun getData(): Any? + } + + data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class ListJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + ), ListSchemaValidator, ListJsonSchema1BoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ListJsonSchema1BoxedList { + return ListJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ListJsonSchema1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ListJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ListJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt new file mode 100644 index 00000000000..a1e0ecc6842 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class MapJsonSchema { + sealed interface MapJsonSchema1Boxed { + fun getData(): Any? + } + + data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class MapJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + ), MapSchemaValidator, MapJsonSchema1BoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MapJsonSchema1BoxedMap { + return MapJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MapJsonSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: MapJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MapJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..f0992da3100 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt @@ -0,0 +1,379 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class NotAnyTypeJsonSchema { + sealed interface NotAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class NotAnyTypeJsonSchema1BoxedVoid(val data: Void?) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NotAnyTypeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null as Void?, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null as Void?, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1BoxedVoid { + return NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Boolean, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedBoolean { + return NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Number, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedNumber { + return NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: String, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedString { + return NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedList { + return NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedMap { + return NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + var instance: NotAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = NotAnyTypeJsonSchema1() + } + return field + } + private set + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt new file mode 100644 index 00000000000..b926c2cdb7c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class NullJsonSchema { + sealed interface NullJsonSchema1Boxed { + fun getData(): Any? + } + + data class NullJsonSchema1BoxedVoid(val data: Nothing?) : NullJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NullJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Void::class.java)) + ), NullSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance(null, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NullJsonSchema1BoxedVoid { + return NullJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NullJsonSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NullJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullJsonSchema1().also { instance = it } + } + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt new file mode 100644 index 00000000000..7f29d2a96a9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt @@ -0,0 +1,104 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class NumberJsonSchema { + sealed interface NumberJsonSchema1Boxed { + fun getData(): Any? + } + + data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NumberJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NumberJsonSchema1BoxedNumber { + return NumberJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NumberJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NumberJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt new file mode 100644 index 00000000000..29f8b0f77f3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt @@ -0,0 +1,111 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class StringJsonSchema { + interface StringJsonSchema1Boxed { + fun getData(): Any? + } + + data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class StringJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + when (arg) { + is UUID -> { + return validate(arg, configuration) + } + + is LocalDate -> { + return validate(arg, configuration) + } + + is ZonedDateTime -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): StringJsonSchema1BoxedString { + return StringJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): StringJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: StringJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt new file mode 100644 index 00000000000..320112a061d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.schemas.validation.MapUtils + +interface UnsetAddPropsSetter { + fun getInstance(): MutableMap + fun getKnownKeys(): Set + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Void): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List<*>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt new file mode 100644 index 00000000000..5586af2b501 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.util.UUID + +open class UuidJsonSchema { + sealed interface UuidJsonSchema1Boxed { + fun getData(): Any? + } + + data class UuidJsonSchema1BoxedString(val data: String) : UuidJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class UuidJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("uuid") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is UUID) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidJsonSchema1BoxedString { + return UuidJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: UuidJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt new file mode 100644 index 00000000000..c7123fd5823 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AdditionalPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val additionalProperties: Class> = data.schema.additionalProperties ?: return null + val presentAdditionalProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentAdditionalProperties.add(key) + } + } + val properties: Map>>? = data.schema.properties + if (properties != null) { + presentAdditionalProperties.removeAll(properties.keys) + } + val pathToSchemas = PathToSchemasMap() + for (addPropName in presentAdditionalProperties) { + val propValue: Any? = data.arg.get(addPropName) + val propPathToItem: List = data.validationMetadata.pathToItem + addPropName + if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas + .containsKey(propPathToItem) + ) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties) + if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt new file mode 100644 index 00000000000..e81a1aebfa6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AllOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val allOf: List>> = data.schema.allOf ?: return null + val pathToSchemas = PathToSchemasMap() + for (allOfClass in allOf) { + val allOfSchema = JsonSchemaFactory.getInstance(allOfClass) + val otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt new file mode 100644 index 00000000000..b264835903b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AnyOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val anyOf: List>> = data.schema.anyOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedAnyOfClasses: MutableList>> = ArrayList() + for (anyOfClass in anyOf) { + if (anyOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke _validate on it because that is recursive + */ + validatedAnyOfClasses.add(anyOfClass) + continue + } + try { + val anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass) + val otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg, data.validationMetadata) + validatedAnyOfClasses.add(anyOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate anyof_classes + } + } + if (validatedAnyOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass.simpleName + ". None " + + "of the anyOf schemas matched the input data." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt new file mode 100644 index 00000000000..7d9535004a2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +abstract class BigDecimalValidator { + @Throws(ValidationException::class) + protected fun getBigDecimal(arg: Number): BigDecimal { + return when (arg) { + is Int -> { + BigDecimal(arg) + } + + is Long -> { + BigDecimal(arg) + } + + is Float -> { + BigDecimal(arg.toString()) + } + + is Double -> { + BigDecimal(arg.toString()) + } + + else -> { + throw ValidationException("Invalid type input for arg") + } + } + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt new file mode 100644 index 00000000000..a6a943fd3b3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface BooleanEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Boolean +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt new file mode 100644 index 00000000000..acdd61917b7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface BooleanSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean + + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt new file mode 100644 index 00000000000..1843f88eae3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface BooleanValueMethod { + fun value(): Boolean +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt new file mode 100644 index 00000000000..9ecd5a5534f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class ConstValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (!data.schema.constValueSet) { + return null + } + val constValue: Any? = data.schema.constValue + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (castArg == constValue) { + return null + } + if (constValue is BigDecimal && constValue.compareTo(castArg) == 0) { + return null + } + } else { + if (data.arg == constValue) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not equal to const " + constValue) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt new file mode 100644 index 00000000000..133e45944c0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List? = data.containsPathToSchemas + if (containsPathToSchemas.isNullOrEmpty()) { + throw ValidationException( + "Validation failed for contains keyword in class=${data.schema.javaClass}" + + " at pathToItem=${data.validationMetadata.pathToItem}. No " + + "items validated to the contains schema." + ) + } + val pathToSchemas = PathToSchemasMap() + for (otherPathToSchema in containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt new file mode 100644 index 00000000000..65afa14827f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.time.ZonedDateTime +import java.time.LocalDate + +class CustomIsoparser { + companion object { + fun parseIsodatetime(dateTime: String): ZonedDateTime { + return ZonedDateTime.parse(dateTime) + } + + fun parseIsodate(date: String): LocalDate { + return LocalDate.parse(date) + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt new file mode 100644 index 00000000000..7f8a8cbfddd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DefaultValueMethod { + @Throws(ValidationException::class) + fun defaultValue(): T +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt new file mode 100644 index 00000000000..d968b55d980 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt @@ -0,0 +1,36 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class DependentRequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentRequired: Map> = data.schema.dependentRequired ?: return null + for ((key, value) in dependentRequired.entries) { + if (!data.arg.containsKey(key)) { + continue + } + val missingKeys: MutableSet = HashSet(value) + for (objKey in data.arg.keys) { + if (objKey is String) { + missingKeys.remove(objKey) + } + } + if (missingKeys.isEmpty()) { + continue + } + throw ValidationException(""" + |Validation failed for dependentRequired because these_keys=$missingKeys are + | missing at pathToItem=${data.validationMetadata.pathToItem} in class + | ${data.schema.javaClass} + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt new file mode 100644 index 00000000000..889ede258bc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class DependentSchemasValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentSchemas: Map>> = data.schema.dependentSchemas ?: return null + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, dependentSchemaClass) in dependentSchemas.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass) + val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt new file mode 100644 index 00000000000..d2f2abe26bb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DoubleEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Double +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt new file mode 100644 index 00000000000..72223e0152a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface DoubleValueMethod { + fun value(): Double +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt new file mode 100644 index 00000000000..9cf161f6255 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ElseValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val elseSchema: Class> = data.schema.elseSchema ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (!ifPathToSchemas.isEmpty()) { + // if validation is true + return null + } + val elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema) + val pathToSchemas = PathToSchemasMap() + val elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an else error? + pathToSchemas.update(elsePathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt new file mode 100644 index 00000000000..f07075606ac --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class EnumValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val enumValues: Set = data.schema.enumValues ?: return null + if (enumValues.isEmpty()) { + throw ValidationException("No value can match enum because enum is empty") + } + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (enumContainsArg(enumValues, castArg)) { + return null + } + for (enumValue in enumValues) { + if (enumValue is BigDecimal && enumValue.compareTo(castArg) == 0) { + return null + } + } + } else { + if (enumContainsArg(enumValues, data.arg)) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not one of the allowed enum " + enumValues) + } + + companion object { + private fun enumContainsArg(enumValues: Set, arg: Any?): Boolean { + return enumValues.contains(arg) + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt new file mode 100644 index 00000000000..5b55d46a38d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt @@ -0,0 +1,43 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ExclusiveMaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMaximum: Number = data.schema.exclusiveMaximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt new file mode 100644 index 00000000000..e19f44defe9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt @@ -0,0 +1,43 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ExclusiveMinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMinimum: Number = data.schema.exclusiveMinimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMinimum.toInt()) < 1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMinimum.toLong()) < 1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMinimum.toFloat()) < 1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMinimum.toDouble()) < 1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt new file mode 100644 index 00000000000..9603f2a6468 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface FloatEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Float +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt new file mode 100644 index 00000000000..23a2817fc0e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface FloatValueMethod { + fun value(): Float +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt new file mode 100644 index 00000000000..47673b8c868 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt @@ -0,0 +1,168 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException +import java.math.BigDecimal +import java.math.BigInteger +import java.time.format.DateTimeParseException +import java.util.UUID +import kotlin.math.floor + +class FormatValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val format: String = data.schema.format ?: return null + if (data.arg is Number) { + validateNumericFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } else if (data.arg is String) { + validateStringFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } + return null + } + + companion object { + private val int32InclusiveMinimum = BigInteger.valueOf(-2147483648L) + private val int32InclusiveMaximum = BigInteger.valueOf(2147483647L) + private val int64InclusiveMinimum = BigInteger.valueOf(Long.MIN_VALUE) + private val int64InclusiveMaximum = BigInteger.valueOf(Long.MAX_VALUE) + private val floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38) + private val floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38) + private val doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308) + private val doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308) + @Throws(ValidationException::class) + private fun validateNumericFormat(arg: Number, validationMetadata: ValidationMetadata, format: String) { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + val intArg: BigInteger + when (arg) { + is Float, is Double -> { + val doubleArg: Double = (arg as? Float)?.toDouble() ?: arg as Double + if (floor(doubleArg) != doubleArg) { + throw ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem + ) + } + intArg = if (arg is Float) { + val smallInt = Math.round(arg) + BigInteger.valueOf(smallInt.toLong()) + } else { + BigInteger.valueOf(Math.round((arg as Double))) + } + } + + is Int -> { + intArg = BigInteger.valueOf(arg.toLong()) + } + + is Long -> { + intArg = BigInteger.valueOf(arg) + } + + else -> { + intArg = arg as BigInteger + } + } + if (format == "int32") { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem + ) + } + } else if (format == "int64") { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem + ) + } + } + } else if (format == "float" || format == "double") { + val decimalArg: BigDecimal = when (arg) { + is Float -> { + BigDecimal.valueOf(arg.toDouble()) + } + + is Double -> { + BigDecimal.valueOf(arg) + } + + else -> { + arg as BigDecimal + } + } + if (format == "float") { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format float at " + validationMetadata.pathToItem + ) + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format double at " + validationMetadata.pathToItem + ) + } + } + } + } + + @Throws(ValidationException::class) + private fun validateStringFormat(arg: String, validationMetadata: ValidationMetadata, format: String) { + when (format) { + "uuid" -> { + try { + UUID.fromString(arg) + } catch (e: IllegalArgumentException) { + throw ValidationException( + "Value cannot be converted to a UUID. Invalid value " + + arg + " for format uuid at " + validationMetadata.pathToItem + ) + } + } + + "number" -> { + try { + BigDecimal(arg) + } catch (e: NumberFormatException) { + throw ValidationException( + "Value cannot be converted to a decimal. Invalid value " + + arg + " for format number at " + validationMetadata.pathToItem + ) + } + } + + "date" -> { + try { + CustomIsoparser.parseIsodate(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 date format. " + + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem + ) + } + } + + "date-time" -> { + try { + CustomIsoparser.parseIsodatetime(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 datetime format. " + + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt new file mode 100644 index 00000000000..94451c44c38 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt @@ -0,0 +1,22 @@ +package org.openapijsonschematools.client.schemas.validation + +open class FrozenList(m: Collection) : AbstractList() { + /* + A frozen List + Once schema validation has been run, indexed access returns values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val list: List + + init { + list = ArrayList(m) + } + + override val size: Int + get() = list.size + + override fun get(index: Int): E { + return list[index] + } +} + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt new file mode 100644 index 00000000000..cce76fb8bad --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException + +open class FrozenMap(m: Map) : AbstractMap() { + /* + A frozen Map + Once schema validation has been run, written accessor methods return values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val map: Map + + init { + map = HashMap(m) + } + + @Throws(UnsetPropertyException::class) + protected fun getOrThrow(key: String): V? { + if (containsKey(key)) { + return get(key) + } + throw UnsetPropertyException("$key is unset") + } + + @Throws(UnsetPropertyException::class) + protected fun throwIfKeyNotPresent(key: String) { + if (!containsKey(key)) { + throw UnsetPropertyException("$key is unset") + } + } + + @Throws(InvalidAdditionalPropertyException::class) + protected fun throwIfKeyKnown(key: String, requiredKeys: Set, optionalKeys: Set) { + val knownKeys: MutableSet = HashSet() + knownKeys.addAll(requiredKeys) + knownKeys.addAll(optionalKeys) + MapUtils.throwIfKeyKnown(key, knownKeys, false) + } + + override val entries: Set> + get() = map.entries +} + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt new file mode 100644 index 00000000000..2a55d6b3528 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class IfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.ifSchema == null) { + return null + } + if (data.ifPathToSchemas == null) { + throw ValidationException("Invalid type for ifPathToSchemas") + } + /* + if is false use case + ifPathToSchemas == {} + no need to add any data to pathToSchemas + + if true, then true -> true for whole schema + so validate_then will add ifPathToSchemas data to pathToSchemas + */ + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt new file mode 100644 index 00000000000..210f0e4dea7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface IntegerEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Int +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt new file mode 100644 index 00000000000..84961e6aa44 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface IntegerValueMethod { + fun value(): Int +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt new file mode 100644 index 00000000000..b4f7e9b9a77 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val items: Class> = data.schema.items ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val itemsSchema = JsonSchemaFactory.getInstance(items) + for (i in minIndex until data.arg.size) { + val itemPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt new file mode 100644 index 00000000000..a4e79ca4c1a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -0,0 +1,512 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.regex.Pattern +import java.util.UUID + +abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { + val type: Set>? + val format: String? + val items: Class>? + val properties: Map>>? + val required: Set? + val exclusiveMaximum: Number? + val exclusiveMinimum: Number? + val maxItems: Int? + val minItems: Int? + val maxLength: Int? + val minLength: Int? + val maxProperties: Int? + val minProperties: Int? + val maximum: Number? + val minimum: Number? + val multipleOf: BigDecimal? + val additionalProperties: Class>? + val allOf: List>>? + val anyOf: List>>? + val oneOf: List>>? + val not: Class>? + val uniqueItems: Boolean? + val enumValues: Set? + val pattern: Pattern? + val defaultValue: Any? + val defaultValueSet: Boolean + val constValue: Any? + val constValueSet: Boolean + val contains: Class>? + val maxContains: Int? + val minContains: Int? + val propertyNames: Class>? + val dependentRequired: Map>? + val dependentSchemas: Map>>? + val patternProperties: Map>>? + val prefixItems: List>>? + val ifSchema: Class>? + val then: Class>? + val elseSchema: Class>? + val unevaluatedItems: Class>? + val unevaluatedProperties: Class>? + private val keywordToValidator: LinkedHashMap + + init { + val keywordToValidator = LinkedHashMap() + type = jsonSchemaInfo.type + if (type != null) { + keywordToValidator["type"] = TypeValidator() + } + format = jsonSchemaInfo.format + if (format != null) { + keywordToValidator["format"] = FormatValidator() + } + items = jsonSchemaInfo.items + if (items != null) { + keywordToValidator["items"] = ItemsValidator() + } + properties = jsonSchemaInfo.properties + if (properties != null) { + keywordToValidator["properties"] = PropertiesValidator() + } + required = jsonSchemaInfo.required + if (required != null) { + keywordToValidator["required"] = RequiredValidator() + } + exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum + if (exclusiveMaximum != null) { + keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() + } + exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum + if (exclusiveMinimum != null) { + keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() + } + maxItems = jsonSchemaInfo.maxItems + if (maxItems != null) { + keywordToValidator["maxItems"] = MaxItemsValidator() + } + minItems = jsonSchemaInfo.minItems + if (minItems != null) { + keywordToValidator["minItems"] = MinItemsValidator() + } + maxLength = jsonSchemaInfo.maxLength + if (maxLength != null) { + keywordToValidator["maxLength"] = MaxLengthValidator() + } + minLength = jsonSchemaInfo.minLength + if (minLength != null) { + keywordToValidator["minLength"] = MinLengthValidator() + } + maxProperties = jsonSchemaInfo.maxProperties + if (maxProperties != null) { + keywordToValidator["maxProperties"] = MaxPropertiesValidator() + } + minProperties = jsonSchemaInfo.minProperties + if (minProperties != null) { + keywordToValidator["minProperties"] = MinPropertiesValidator() + } + maximum = jsonSchemaInfo.maximum + if (maximum != null) { + keywordToValidator["maximum"] = MaximumValidator() + } + minimum = jsonSchemaInfo.minimum + if (minimum != null) { + keywordToValidator["minimum"] = MinimumValidator() + } + multipleOf = jsonSchemaInfo.multipleOf + if (multipleOf != null) { + keywordToValidator["multipleOf"] = MultipleOfValidator() + } + additionalProperties = jsonSchemaInfo.additionalProperties + if (additionalProperties != null) { + keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() + } + allOf = jsonSchemaInfo.allOf + if (allOf != null) { + keywordToValidator["allOf"] = AllOfValidator() + } + anyOf = jsonSchemaInfo.anyOf + if (anyOf != null) { + keywordToValidator["anyOf"] = AnyOfValidator() + } + oneOf = jsonSchemaInfo.oneOf + if (oneOf != null) { + keywordToValidator["oneOf"] = OneOfValidator() + } + not = jsonSchemaInfo.not + if (not != null) { + keywordToValidator["not"] = NotValidator() + } + uniqueItems = jsonSchemaInfo.uniqueItems + if (uniqueItems != null) { + keywordToValidator["uniqueItems"] = UniqueItemsValidator() + } + enumValues = jsonSchemaInfo.enumValues + if (enumValues != null) { + keywordToValidator["enum"] = EnumValidator() + } + pattern = jsonSchemaInfo.pattern + if (pattern != null) { + keywordToValidator["pattern"] = PatternValidator() + } + defaultValue = jsonSchemaInfo.defaultValue + defaultValueSet = jsonSchemaInfo.defaultValueSet + constValue = jsonSchemaInfo.constValue + constValueSet = jsonSchemaInfo.constValueSet + if (constValueSet) { + keywordToValidator["const"] = ConstValidator() + } + contains = jsonSchemaInfo.contains + if (contains != null) { + keywordToValidator["contains"] = ContainsValidator() + } + maxContains = jsonSchemaInfo.maxContains + if (maxContains != null) { + keywordToValidator["maxContains"] = MaxContainsValidator() + } + minContains = jsonSchemaInfo.minContains + if (minContains != null) { + keywordToValidator["minContains"] = MinContainsValidator() + } + propertyNames = jsonSchemaInfo.propertyNames + if (propertyNames != null) { + keywordToValidator["propertyNames"] = PropertyNamesValidator() + } + dependentRequired = jsonSchemaInfo.dependentRequired + if (dependentRequired != null) { + keywordToValidator["dependentRequired"] = DependentRequiredValidator() + } + dependentSchemas = jsonSchemaInfo.dependentSchemas + if (dependentSchemas != null) { + keywordToValidator["dependentSchemas"] = DependentSchemasValidator() + } + patternProperties = jsonSchemaInfo.patternProperties + if (patternProperties != null) { + keywordToValidator["patternProperties"] = PatternPropertiesValidator() + } + prefixItems = jsonSchemaInfo.prefixItems + if (prefixItems != null) { + keywordToValidator["prefixItems"] = PrefixItemsValidator() + } + ifSchema = jsonSchemaInfo.ifSchema + if (ifSchema != null) { + keywordToValidator["if"] = IfValidator() + } + then = jsonSchemaInfo.then + if (then != null) { + keywordToValidator["then"] = ThenValidator() + } + elseSchema = jsonSchemaInfo.elseSchema + if (elseSchema != null) { + keywordToValidator["else"] = ElseValidator() + } + unevaluatedItems = jsonSchemaInfo.unevaluatedItems + if (unevaluatedItems != null) { + keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() + } + unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties + if (unevaluatedProperties != null) { + keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() + } + this.keywordToValidator = keywordToValidator + } + + abstract fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? + @Throws(ValidationException::class) + abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? + @Throws(ValidationException::class) + abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T + private fun getContainsPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): List { + if (arg !is List<*> || contains == null) { + return ArrayList() + } + val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) + val containsPathToSchemas: MutableList = ArrayList() + for (i in arg.indices) { + val thesePathToSchemas = PathToSchemasMap() + val itemPathToItem: List = validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(containsSchema)) { + // todo add_deeper_validated_schemas + containsPathToSchemas.add(thesePathToSchemas) + continue + } + try { + val otherPathToSchemas = validate( + containsSchema, arg[i], itemValidationMetadata + ) + containsPathToSchemas.add(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + } + return containsPathToSchemas + } + + @Throws(ValidationException::class) + private fun getPatternPropertiesPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (arg !is Map<*, *> || patternProperties == null) { + return PathToSchemasMap() + } + val pathToSchemas = PathToSchemasMap() + for ((key, value) in arg) { + val entryKey = key!! as? String + ?: throw ValidationException("Invalid non-string type for map key") + val propPathToItem: List = validationMetadata.pathToItem + entryKey + val propValidationMetadata = ValidationMetadata( + propPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + for ((key1, patternPropClass) in patternProperties) { + if (!key1.matcher(entryKey).find()) { + continue + } + val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) + val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + } + return pathToSchemas + } + + private fun getIfPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (ifSchema == null) { + return PathToSchemasMap() + } + val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) + val pathToSchemas = PathToSchemasMap() + try { + val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + return pathToSchemas + } + + protected fun castToAllowedTypes(arg: String, pathToItem: List, pathSet: MutableSet>): String { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List, pathSet: MutableSet>): Boolean { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Number, pathToItem: List, pathSet: MutableSet>): Number { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Nothing?, pathToItem: List, pathSet: MutableSet>): Nothing? { + pathSet.add(pathToItem) + return arg + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List, pathSet: MutableSet>): List<*> { + pathSet.add(pathToItem) + val argFixed: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val newPathToItem: List = pathToItem + i + val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) + argFixed.add(fixedVal) + i += 1 + } + return argFixed + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes( + arg: Map<*, *>, + pathToItem: List, + pathSet: MutableSet> + ): Map<*, *> { + pathSet.add(pathToItem) + val argFixed = LinkedHashMap() + for ((entryKey, value) in arg) { + if (entryKey !is String) { + throw ValidationException("Invalid non-string key value") + } + val newPathToItem: List = pathToItem + entryKey + val fixedVal = castToAllowedObjectTypes(value, newPathToItem, pathSet) + argFixed[entryKey] = fixedVal + } + return argFixed + } + + @Throws(ValidationException::class) + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { + return when (arg) { + null -> { + castToAllowedTypes(null, pathToItem, pathSet) + } + is String -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Map<*, *> -> { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Boolean -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Number -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is List<*> -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is ZonedDateTime -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is LocalDate -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is UUID -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + else -> { + val argClass = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + } + } + } + + protected fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { + return arg + } + + protected fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + return arg + } + + protected fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { + return arg + } + + protected fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + return arg + } + + companion object { + @Throws(ValidationException::class) + fun validate( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + val disabledKeywords: LinkedHashSet = + validationMetadata.configuration.disabledKeywordFlags.keywords + val pathToSchemas = PathToSchemasMap() + val thisKeywordToValidator = jsonSchema.keywordToValidator + var containsPathToSchemas: List? = null + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) + } + var patternPropertiesPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) + } + var ifPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) + } + var knownPathToSchemas: PathToSchemasMap? = null + for ((jsonKeyword, validator) in thisKeywordToValidator) { + if (disabledKeywords.contains(jsonKeyword)) { + val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format + if (!typeIntegerUseCase) { + continue + } + } + if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { + knownPathToSchemas = pathToSchemas + } + val data = ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ) + val otherPathToSchemas = validator.validate(data) ?: continue + pathToSchemas.update(otherPathToSchemas) + } + val pathToItem: List = validationMetadata.pathToItem + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + } + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] + if (schemas != null) { + schemas[jsonSchema] = null + } + return pathToSchemas + } + + @JvmStatic + @Throws(ValidationException::class) + protected fun getPathToSchemas( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata, + pathSet: Set> + ): PathToSchemasMap { + val pathToSchemasMap = PathToSchemasMap() + // todo add check of validationMetadata.validationRanEarlier(this) + val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) + pathToSchemasMap.update(otherPathToSchemas) + for (schemas in pathToSchemasMap.values) { + val firstSchema: JsonSchema<*> = schemas.entries.iterator().next().key + schemas.clear() + schemas[firstSchema] = null + } + val mutPathSet: MutableSet> = pathSet.toMutableSet() + mutPathSet.removeAll(pathToSchemasMap.keys) + if (mutPathSet.isNotEmpty()) { + val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() + unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null + for (pathToItem in mutPathSet) { + pathToSchemasMap[pathToItem] = unsetAnyTypeSchema + } + } + return pathToSchemasMap + } + + fun getClass(arg: Any?): String { + return if (arg == null) { + Void::class.java.getSimpleName() + } else { + arg.javaClass.getSimpleName() + } + } // todo add bytes and FileIO + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt new file mode 100644 index 00000000000..3de64242080 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.lang.reflect.InvocationTargetException + +object JsonSchemaFactory { + private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() + + fun > getInstance(schemaCls: Class): V { + val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] + cacheInst?.let { + assert(schemaCls.isInstance(it)) + return schemaCls.cast(it) + } + try { + val companion = schemaCls.declaredClasses[0] + val method = companion.getMethod("getInstance") + val obj = method.invoke(companion.kotlin.objectInstance) + assert(schemaCls.isInstance(obj)) + val inst = schemaCls.cast(obj) + classToInstance[schemaCls] = inst + return inst + } catch (e: NoSuchMethodException) { + throw RuntimeException(e) + } catch (e: IllegalAccessException) { + throw RuntimeException(e) + } catch (e: InvocationTargetException) { + throw RuntimeException(e) + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt new file mode 100644 index 00000000000..b36f28c46a4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt @@ -0,0 +1,244 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.math.BigDecimal +import java.util.regex.Pattern + +class JsonSchemaInfo { + var type: Set>? = null + fun type(type: Set>): JsonSchemaInfo { + this.type = type + return this + } + + var format: String? = null + fun format(format: String): JsonSchemaInfo { + this.format = format + return this + } + + var items: Class>? = null + fun items(items: Class>): JsonSchemaInfo { + this.items = items + return this + } + + var properties: Map>>? = null + fun properties(properties: Map>>): JsonSchemaInfo { + this.properties = properties + return this + } + + var required: Set? = null + fun required(required: Set): JsonSchemaInfo { + this.required = required + return this + } + + var exclusiveMaximum: Number? = null + fun exclusiveMaximum(exclusiveMaximum: Number): JsonSchemaInfo { + this.exclusiveMaximum = exclusiveMaximum + return this + } + + var exclusiveMinimum: Number? = null + fun exclusiveMinimum(exclusiveMinimum: Number): JsonSchemaInfo { + this.exclusiveMinimum = exclusiveMinimum + return this + } + + var maxItems: Int? = null + fun maxItems(maxItems: Int): JsonSchemaInfo { + this.maxItems = maxItems + return this + } + + var minItems: Int? = null + fun minItems(minItems: Int): JsonSchemaInfo { + this.minItems = minItems + return this + } + + var maxLength: Int? = null + fun maxLength(maxLength: Int): JsonSchemaInfo { + this.maxLength = maxLength + return this + } + + var minLength: Int? = null + fun minLength(minLength: Int): JsonSchemaInfo { + this.minLength = minLength + return this + } + + var maxProperties: Int? = null + fun maxProperties(maxProperties: Int): JsonSchemaInfo { + this.maxProperties = maxProperties + return this + } + + var minProperties: Int? = null + fun minProperties(minProperties: Int): JsonSchemaInfo { + this.minProperties = minProperties + return this + } + + var maximum: Number? = null + fun maximum(maximum: Number): JsonSchemaInfo { + this.maximum = maximum + return this + } + + var minimum: Number? = null + fun minimum(minimum: Number): JsonSchemaInfo { + this.minimum = minimum + return this + } + + var multipleOf: BigDecimal? = null + fun multipleOf(multipleOf: BigDecimal): JsonSchemaInfo { + this.multipleOf = multipleOf + return this + } + + var additionalProperties: Class>? = null + fun additionalProperties(additionalProperties: Class>): JsonSchemaInfo { + this.additionalProperties = additionalProperties + return this + } + + var allOf: List>>? = null + fun allOf(allOf: List>>): JsonSchemaInfo { + this.allOf = allOf + return this + } + + var anyOf: List>>? = null + fun anyOf(anyOf: List>>): JsonSchemaInfo { + this.anyOf = anyOf + return this + } + + var oneOf: List>>? = null + fun oneOf(oneOf: List>>): JsonSchemaInfo { + this.oneOf = oneOf + return this + } + + var not: Class>? = null + fun not(not: Class>): JsonSchemaInfo { + this.not = not + return this + } + + var uniqueItems: Boolean? = null + fun uniqueItems(uniqueItems: Boolean): JsonSchemaInfo { + this.uniqueItems = uniqueItems + return this + } + + var enumValues: Set? = null + fun enumValues(enumValues: Set): JsonSchemaInfo { + this.enumValues = enumValues + return this + } + + var pattern: Pattern? = null + fun pattern(pattern: Pattern): JsonSchemaInfo { + this.pattern = pattern + return this + } + + var defaultValue: Any? = null + var defaultValueSet = false + fun defaultValue(defaultValue: Any?): JsonSchemaInfo { + this.defaultValue = defaultValue + defaultValueSet = true + return this + } + + var constValue: Any? = null + var constValueSet = false + fun constValue(constValue: Any?): JsonSchemaInfo { + this.constValue = constValue + constValueSet = true + return this + } + + var contains: Class>? = null + fun contains(contains: Class>): JsonSchemaInfo { + this.contains = contains + return this + } + + var maxContains: Int? = null + fun maxContains(maxContains: Int): JsonSchemaInfo { + this.maxContains = maxContains + return this + } + + var minContains: Int? = null + fun minContains(minContains: Int): JsonSchemaInfo { + this.minContains = minContains + return this + } + + var propertyNames: Class>? = null + fun propertyNames(propertyNames: Class>): JsonSchemaInfo { + this.propertyNames = propertyNames + return this + } + + var dependentRequired: Map>? = null + fun dependentRequired(dependentRequired: Map>): JsonSchemaInfo { + this.dependentRequired = dependentRequired + return this + } + + var dependentSchemas: Map>>? = null + fun dependentSchemas(dependentSchemas: Map>>): JsonSchemaInfo { + this.dependentSchemas = dependentSchemas + return this + } + + var patternProperties: Map>>? = null + fun patternProperties(patternProperties: Map>>): JsonSchemaInfo { + this.patternProperties = patternProperties + return this + } + + var prefixItems: List>>? = null + fun prefixItems(prefixItems: List>>): JsonSchemaInfo { + this.prefixItems = prefixItems + return this + } + + var ifSchema: Class>? = null + fun ifSchema(ifSchema: Class>): JsonSchemaInfo { + this.ifSchema = ifSchema + return this + } + + var then: Class>? = null + fun then(then: Class>): JsonSchemaInfo { + this.then = then + return this + } + + var elseSchema: Class>? = null + fun elseSchema(elseSchema: Class>): JsonSchemaInfo { + this.elseSchema = elseSchema + return this + } + + var unevaluatedItems: Class>? = null + fun unevaluatedItems(unevaluatedItems: Class>): JsonSchemaInfo { + this.unevaluatedItems = unevaluatedItems + return this + } + + var unevaluatedProperties: Class>? = null + fun unevaluatedProperties(unevaluatedProperties: Class>): JsonSchemaInfo { + this.unevaluatedProperties = unevaluatedProperties + return this + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt new file mode 100644 index 00000000000..59e9d5bec4f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.util.AbstractMap + +class KeywordEntry(key: String, value: KeywordValidator) : + AbstractMap.SimpleEntry(key, value) diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt new file mode 100644 index 00000000000..c707681f8bf --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt @@ -0,0 +1,10 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +fun interface KeywordValidator { + @Throws(ValidationException::class) + fun validate( + data: ValidationData + ): PathToSchemasMap? +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt new file mode 100644 index 00000000000..50a273b85eb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.text.BreakIterator + +abstract class LengthValidator { + protected fun getLength(text: String?): Int { + var graphemeCount = 0 + val graphemeCounter = BreakIterator + .getCharacterInstance() + graphemeCounter.setText(text) + while (graphemeCounter.next() != BreakIterator.DONE) { + graphemeCount++ + } + return graphemeCount + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt new file mode 100644 index 00000000000..59c8c533bb2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface ListSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt new file mode 100644 index 00000000000..c8fc6db061f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface LongEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Long +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt new file mode 100644 index 00000000000..8d1f0ddc419 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface LongValueMethod { + fun value(): Long +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt new file mode 100644 index 00000000000..bf11248a121 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface MapSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt new file mode 100644 index 00000000000..5e6a8383648 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException + +class MapUtils { + companion object { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value + } + return map + } + + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { + if (knownKeys.contains(key)) { + var verb = "getting" + if (setting) { + verb = "setting" + } + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt new file mode 100644 index 00000000000..3783b2da69e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxContains: Int = data.schema.maxContains ?: return null + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List = data.containsPathToSchemas ?: return null + if (containsPathToSchemas.size > maxContains) { + throw ValidationException(""" + |Validation failed for maxContains keyword in class=${data.schema.javaClass} + | at pathToItem=${data.validationMetadata.pathToItem}. Too many items" + | validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt new file mode 100644 index 00000000000..d18c07d9b79 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxItems: Int = data.schema.maxItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size > maxItems) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxItems of $maxItems") + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt new file mode 100644 index 00000000000..ca9c267dbd9 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxLength: Int = data.schema.maxLength ?: return null + if (data.arg !is String) { + return null + } + val length: Int = getLength(data.arg) + if (length > maxLength) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxLength of $maxLength") + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt new file mode 100644 index 00000000000..1287a6b789f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxProperties: Int = data.schema.maxProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size > maxProperties) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxProperties of $maxProperties") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt new file mode 100644 index 00000000000..b8070b6c4d1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt @@ -0,0 +1,42 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maximum: Number = data.schema.maximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is > the maximum of " + maximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(maximum.toInt()) > 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(maximum.toLong()) > 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(maximum.toFloat()) > 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(maximum.toDouble()) > 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt new file mode 100644 index 00000000000..73b74a6b3aa --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minContains: Int = data.schema.minContains ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.containsPathToSchemas == null) { + return null + } + if (data.containsPathToSchemas.size < minContains) { + throw ValidationException(""" + |Validation failed for minContains keyword in class=${data.schema.javaClass} at + | pathToItem=${data.validationMetadata.pathToItem}. + | Too few items validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt new file mode 100644 index 00000000000..0f92b86cdc8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minItems: Int = data.schema.minItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size < minItems) { + throw ValidationException("Value ${data.arg} is invalid because has < the minItems of $minItems") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt new file mode 100644 index 00000000000..95228a8e132 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minLength: Int = data.schema.minLength ?: return null + if (data.arg !is String) { + return null + } + val length = getLength(data.arg) + if (length < minLength) { + throw ValidationException("Value ${data.arg} is invalid because has < the minLength of $minLength") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt new file mode 100644 index 00000000000..01a2828c523 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minProperties: Int = data.schema.minProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size < minProperties) { + throw ValidationException("Value ${data.arg} is invalid because has < the minProperties of $minProperties") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt new file mode 100644 index 00000000000..89cfc38f73a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt @@ -0,0 +1,42 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minimum: Number = data.schema.minimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is < the minimum of " + minimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(minimum.toInt()) < 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(minimum.toLong()) < 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(minimum.toFloat()) < 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(minimum.toDouble()) < 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt new file mode 100644 index 00000000000..a1bf8794ae3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val multipleOf: BigDecimal = data.schema.multipleOf ?: return null + if (data.arg !is Number) { + return null + } + val castArg: BigDecimal = getBigDecimal(data.arg) + val msg = "Value ${data.arg} is invalid because it is not a multiple of $multipleOf" + if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { + throw ValidationException(msg) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt new file mode 100644 index 00000000000..fe2eeaa2dfa --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class NotValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val not: Class> = data.schema.not ?: return null + val pathToSchemas: PathToSchemasMap = try { + val notSchema = JsonSchemaFactory.getInstance(not) + JsonSchema.validate(notSchema, data.arg, data.validationMetadata) + } catch (e: ValidationException) { + return null + } + if (!pathToSchemas.isEmpty()) { + throw ValidationException( + "Invalid value " + data.arg + " was passed in to " + data.schema.javaClass + + ". Value is invalid because it is disallowed by not " + not + ) + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt new file mode 100644 index 00000000000..7f3f09ebd70 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NullEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Nothing? +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt new file mode 100644 index 00000000000..b0e8462d4cf --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NullSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? + + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt new file mode 100644 index 00000000000..291eac2a663 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface NullValueMethod { + fun value(): Nothing? +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt new file mode 100644 index 00000000000..cf4b7e2365b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NumberSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number + + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt new file mode 100644 index 00000000000..b11ae07f2c5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class OneOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val oneOf: List>> = data.schema.oneOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedOneOfClasses: MutableList>> = ArrayList() + for (oneOfClass in oneOf) { + if (oneOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke validate on it because that is recursive + */ + validatedOneOfClasses.add(oneOfClass) + continue + } + try { + val oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass) + val otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg, data.validationMetadata) + validatedOneOfClasses.add(oneOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate validatedOneOfClasses + } + } + if (validatedOneOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + ". None " + + "of the oneOf schemas matched the input data." + ) + } + if (validatedOneOfClasses.size > 1) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + + ". Multiple oneOf schemas validated the data, but a max of one is allowed." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt new file mode 100644 index 00000000000..61d124a2a43 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt @@ -0,0 +1,13 @@ +package org.openapijsonschematools.client.schemas.validation + +class PathToSchemasMap : LinkedHashMap, LinkedHashMap, Nothing?>>() { + fun update(other: PathToSchemasMap) { + for ((pathToItem, otherSchemas) in other) { + if (containsKey(pathToItem)) { + get(pathToItem)!!.putAll(otherSchemas) + } else { + put(pathToItem, otherSchemas) + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt new file mode 100644 index 00000000000..1ba9fd8396b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +class PatternPropertiesValidator : KeywordValidator { + override fun validate( + data: ValidationData + ): PathToSchemasMap? + { + if (data.schema.patternProperties == null) { + return null + } + return if (data.arg !is Map<*, *>) { + null + } else data.patternPropertiesPathToSchemas + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt new file mode 100644 index 00000000000..085c21a2943 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.util.regex.Pattern + +class PatternValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val pattern: Pattern = data.schema.pattern ?: return null + if (data.arg !is String) { + return null + } + if (!pattern.matcher(data.arg).find()) { + throw ValidationException("Invalid value ${data.arg} did not find a match for pattern $pattern") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt new file mode 100644 index 00000000000..6435a86bfe1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.math.min + +class PrefixItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val prefixItems: List>> = data.schema.prefixItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val maxIndex: Int = min(data.arg.size, prefixItems.size) + for (i in 0 until maxIndex) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val itemsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(prefixItems[i]) + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt new file mode 100644 index 00000000000..93cb2bcb320 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class PropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val properties: Map>> = data.schema.properties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, propClass) in properties.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val propValue: Any? = data.arg[propName] + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(propName) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val propSchema = JsonSchemaFactory.getInstance(propClass) + if (propValidationMetadata.validationRanEarlier(propSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt new file mode 100644 index 00000000000..3e41a82ebb8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class PropertyNamesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val propertyNames: Class> = data.schema.propertyNames ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames) + for (objKey in data.arg.keys) { + if (objKey is String) { + val propPathToItem: List = data.validationMetadata.pathToItem + objKey + val keyValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + JsonSchema.validate(propertyNamesSchema, objKey, keyValidationMetadata) + } + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt new file mode 100644 index 00000000000..d2ac79c82d7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class RequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val required: Set = data.schema.required ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val missingRequiredProperties: MutableSet = HashSet(required) + for (key in data.arg.keys) { + if (key is String) { + missingRequiredProperties.remove(key) + } + } + if (missingRequiredProperties.isNotEmpty()) { + val missingReqProps: List = missingRequiredProperties.toList().sorted() + var pluralChar = "" + if (missingRequiredProperties.size > 1) { + pluralChar = "s" + } + throw ValidationException( + data.schema.javaClass.simpleName + " is missing " + missingRequiredProperties.size + " required argument" + pluralChar + ": " + missingReqProps + ) + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt new file mode 100644 index 00000000000..c23532466f2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface StringEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): String +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt new file mode 100644 index 00000000000..b9622585d38 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface StringSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String + + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt new file mode 100644 index 00000000000..4e2ddeaf4e0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface StringValueMethod { + fun value(): String +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt new file mode 100644 index 00000000000..d63a1a36d18 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ThenValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val then: Class> = data.schema.then ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (ifPathToSchemas.isEmpty()) { + // if validation is false + return null + } + val thenSchema = JsonSchemaFactory.getInstance(then) + val pathToSchemas = PathToSchemasMap() + val thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an then error? + pathToSchemas.update(ifPathToSchemas) + pathToSchemas.update(thenPathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt new file mode 100644 index 00000000000..635d85eb28c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt @@ -0,0 +1,51 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class TypeValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.type == null) { + return null + } + val argClass = when (data.arg) { + null -> { + Void::class.java + } + is List<*> -> { + List::class.java + } + + is Map<*, *> -> { + Map::class.java + } + + is Boolean -> { + Boolean::class.java + } + + is Int -> { + Int::class.java + } + is Long -> { + Long::class.java + } + is Double -> { + Double::class.java + } + is Float -> { + Float::class.java + } + + else -> { + data.arg.javaClass + } + } + if (!data.schema.type.contains(argClass)) { + throw ValidationException("invalid type") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt new file mode 100644 index 00000000000..4ac1a823821 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt @@ -0,0 +1,41 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UnevaluatedItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedItems: Class> = data.schema.unevaluatedItems ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems) + for (i in minIndex until data.arg.size) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + if (knownPathToSchemas.containsKey(itemPathToItem)) { + continue + } + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt new file mode 100644 index 00000000000..f78940fc822 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt @@ -0,0 +1,36 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UnevaluatedPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedProperties: Class> = data.schema.unevaluatedProperties ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties) + for ((key, value) in data.arg.entries) { + if (key !is String) { + throw ValidationException("Map keys must be strings") + } + val propPathToItem: List = data.validationMetadata.pathToItem + key + if (knownPathToSchemas.containsKey(propPathToItem)) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt new file mode 100644 index 00000000000..2c2f41591b0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UniqueItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val uniqueItems: Boolean = data.schema.uniqueItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (!uniqueItems) { + return null + } + val seenItems: MutableSet = HashSet() + for (item in data.arg) { + val startingSeenItemsSize = seenItems.size + seenItems.add(item) + if (seenItems.size == startingSeenItemsSize) { + throw ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true") + } + } + return null + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..3797fa632b2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -0,0 +1,336 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class UnsetAnyTypeJsonSchema { + sealed interface UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + data class UnsetAnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: UnsetAnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnsetAnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt new file mode 100644 index 00000000000..4629847ee87 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt @@ -0,0 +1,11 @@ +package org.openapijsonschematools.client.schemas.validation + +data class ValidationData( + val schema: JsonSchema<*>, + val arg: Any?, + val validationMetadata: ValidationMetadata, + val containsPathToSchemas: List? = null, + val patternPropertiesPathToSchemas: PathToSchemasMap? = null, + val ifPathToSchemas: PathToSchemasMap? = null, + val knownPathToSchemas: PathToSchemasMap? = null +) \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt new file mode 100644 index 00000000000..39ccadbdde6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration + +data class ValidationMetadata( + val pathToItem: List, + val configuration: SchemaConfiguration, + val validatedPathToSchemas: PathToSchemasMap, + val seenClasses: Set> +) { + fun validationRanEarlier(schema: JsonSchema<*>): Boolean { + val validatedSchemas: Map, Nothing?>? = validatedPathToSchemas[pathToItem] + if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { + return true + } + return seenClasses.contains(schema.javaClass) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt new file mode 100644 index 00000000000..6b3d3c867c2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +import org.openapijsonschematools.client.servers.ServerWithoutVariables; + +class RootServer0 : ServerWithoutVariables("https://someserver.com/v1") { +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt new file mode 100644 index 00000000000..916d6a489bf --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.servers; + +interface Server { + fun url(): String +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt new file mode 100644 index 00000000000..65dcd7942f5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +interface ServerProvider { + fun getServer(serverIndex: T): Server +} + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt new file mode 100644 index 00000000000..7cf85cd8ccf --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.servers + +abstract class ServerWithVariables> protected constructor(url: String, variables: T) : + Server { + val url: String + val variables: T + + init { + var url = url + this.variables = variables + for ((key, value) in variables) { + url = url.replace("{$key}", value) + } + this.url = url + } + + override fun url(): String { + return url + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt new file mode 100644 index 00000000000..6267cc468f5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.servers; + +abstract class ServerWithoutVariables protected constructor(val url: String) : Server { + override fun url(): String { + return url + } +} + diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.kt new file mode 100644 index 00000000000..cd3dd2caabd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidateTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesAllowsASchemaWhichShouldValidateTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNoAdditionalPropertiesIsValidPasses() { + // no additional properties is valid + val schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + 12 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt new file mode 100644 index 00000000000..0a6f7f758b3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesAreAllowedByDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAdditionalPropertiesAreAllowedPasses() { + // additional properties are allowed + val schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt new file mode 100644 index 00000000000..e4b32602f7e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesCanExistByItselfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.kt new file mode 100644 index 00000000000..cc3c64c1cfc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicatorsTest.kt @@ -0,0 +1,56 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesShouldNotLookInApplicatorsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertiesDefinedInAllofAreNotExaminedFails() { + // properties defined in allOf are not examined + val schema = AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + true + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidTestCasePasses() { + // valid test case + val schema = AdditionalpropertiesShouldNotLookInApplicators.AdditionalpropertiesShouldNotLookInApplicators1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + false + ), + Pair( + "bar", + true + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt new file mode 100644 index 00000000000..5703d263e49 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt @@ -0,0 +1,122 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofCombinedWithAnyofOneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllofFalseAnyofFalseOneofTrueFails() { + // allOf: false, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 5, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofFalseFails() { + // allOf: false, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofTrueFails() { + // allOf: false, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 15, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofFalseFails() { + // allOf: true, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 2, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofTruePasses() { + // allOf: true, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + schema.validate( + 30, + configuration + ) + } + + @Test + fun testAllofFalseAnyofFalseOneofFalseFails() { + // allOf: false, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofTrueFails() { + // allOf: true, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 10, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofFalseFails() { + // allOf: true, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 6, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt new file mode 100644 index 00000000000..ff6e7d933dd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofSimpleTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchOneFails() { + // mismatch one + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + schema.validate( + 25, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt new file mode 100644 index 00000000000..c2af359082b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchSecondFails() { + // mismatch second + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongTypeFails() { + // wrong type + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstFails() { + // mismatch first + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAllofPasses() { + // allOf + val schema = Allof.Allof1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..f4b4b2af3fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt @@ -0,0 +1,125 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstAllofFails() { + // mismatch first allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + + @Test + fun testMismatchBothFails() { + // mismatch both + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchSecondAllofFails() { + // mismatch second allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..081371231ec --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt new file mode 100644 index 00000000000..5f40ab6e1ce --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheFirstEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt new file mode 100644 index 00000000000..1669c0495aa --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheLastEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt new file mode 100644 index 00000000000..e9e9a86e68e --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTwoEmptySchemasTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt new file mode 100644 index 00000000000..997c742aa1f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondAnyofValidComplexPasses() { + // second anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothAnyofValidComplexPasses() { + // both anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testFirstAnyofValidComplexPasses() { + // first anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherAnyofValidComplexFails() { + // neither anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt new file mode 100644 index 00000000000..a525d7d0312 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothAnyofValidPasses() { + // both anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 3, + configuration + ) + } + + @Test + fun testNeitherAnyofValidFails() { + // neither anyOf valid + val schema = Anyof.Anyof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testFirstAnyofValidPasses() { + // first anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testSecondAnyofValidPasses() { + // second anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..76ed26e5272 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneAnyofValidPasses() { + // one anyOf valid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothAnyofInvalidFails() { + // both anyOf invalid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..9a0ca10b5cd --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testStringIsValidPasses() { + // string is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt new file mode 100644 index 00000000000..22b7c3e8cce --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ArrayTypeMatchesArraysTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testABooleanIsNotAnArrayFails() { + // a boolean is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnArrayFails() { + // a float is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsAnArrayPasses() { + // an array is an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + schema.validate( + ArrayTypeMatchesArrays.ArrayTypeMatchesArraysListBuilder() + .build(), + configuration + ) + } + + @Test + fun testNullIsNotAnArrayFails() { + // null is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnArrayFails() { + // a string is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnArrayFails() { + // an integer is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAnArrayFails() { + // an object is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt new file mode 100644 index 00000000000..c9fb755da34 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BooleanTypeMatchesBooleansTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsNotABooleanFails() { + // a float is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotABooleanFails() { + // a string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testFalseIsABooleanPasses() { + // false is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testTrueIsABooleanPasses() { + // true is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testAnObjectIsNotABooleanFails() { + // an object is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotABooleanFails() { + // an array is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotABooleanFails() { + // null is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotABooleanFails() { + // an integer is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testZeroIsNotABooleanFails() { + // zero is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotABooleanFails() { + // an empty string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt new file mode 100644 index 00000000000..89bd4860dd8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByIntTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIntByIntFailFails() { + // int by int fail + val schema = ByInt.ByInt1.getInstance() + assertFailsWith( + block = { + schema.validate( + 7, + configuration + ) + } + ) + } + + @Test + fun testIntByIntPasses() { + // int by int + val schema = ByInt.ByInt1.getInstance() + schema.validate( + 10, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ByInt.ByInt1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt new file mode 100644 index 00000000000..a6fd5fe3f47 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test35IsNotMultipleOf15Fails() { + // 35 is not multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun test45IsMultipleOf15Passes() { + // 4.5 is multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 4.5, + configuration + ) + } + + @Test + fun testZeroIsMultipleOfAnythingPasses() { + // zero is multiple of anything + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt new file mode 100644 index 00000000000..f6fc84b9514 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BySmallNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test000751IsNotMultipleOf00001Fails() { + // 0.00751 is not multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.00751, + configuration + ) + } + ) + } + + @Test + fun test00075IsMultipleOf00001Passes() { + // 0.0075 is multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + schema.validate( + 0.0075, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt new file mode 100644 index 00000000000..7e1b2ddd554 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DateTimeFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt new file mode 100644 index 00000000000..ac03907d1c0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EmailFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt new file mode 100644 index 00000000000..c398f777e9a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith0DoesNotMatchFalseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsValidPasses() { + // float zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0.0, + configuration + ) + } + + @Test + fun testFalseIsInvalidFails() { + // false is invalid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testIntegerZeroIsValidPasses() { + // integer zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt new file mode 100644 index 00000000000..8ff4f796ea8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith1DoesNotMatchTrueTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTrueIsInvalidFails() { + // true is invalid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFloatOneIsValidPasses() { + // float one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testIntegerOneIsValidPasses() { + // integer one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..66bd002ada2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnotherStringIsInvalidFails() { + // another string is invalid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testMember2IsValidPasses() { + // member 2 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\rbar", + configuration + ) + } + + @Test + fun testMember1IsValidPasses() { + // member 1 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\nbar", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt new file mode 100644 index 00000000000..540c60f5577 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithFalseDoesNotMatch0Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsInvalidFails() { + // float zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.0, + configuration + ) + } + ) + } + + @Test + fun testFalseIsValidPasses() { + // false is valid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testIntegerZeroIsInvalidFails() { + // integer zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt new file mode 100644 index 00000000000..4f5ca3b42fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithTrueDoesNotMatch1Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatOneIsInvalidFails() { + // float one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0, + configuration + ) + } + ) + } + + @Test + fun testIntegerOneIsInvalidFails() { + // integer one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testTrueIsValidPasses() { + // true is valid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + schema.validate( + true, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt new file mode 100644 index 00000000000..d98a079ce00 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt @@ -0,0 +1,128 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumsInPropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWrongBarValueFails() { + // wrong bar value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bart" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongFooValueFails() { + // wrong foo value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foot" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMissingAllPropertiesIsInvalidFails() { + // missing all properties is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testBothPropertiesAreValidPasses() { + // both properties are valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingOptionalPropertyIsValidPasses() { + // missing optional property is valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingRequiredPropertyIsInvalidFails() { + // missing required property is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt new file mode 100644 index 00000000000..79c52a38bb6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt @@ -0,0 +1,56 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ForbiddenPropertyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyPresentFails() { + // property present + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyAbsentPasses() { + // property absent + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 1 + ), + Pair( + "baz", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt new file mode 100644 index 00000000000..40fb2cc72e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class HostnameFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt new file mode 100644 index 00000000000..5acb5daa6ce --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt @@ -0,0 +1,134 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IntegerTypeMatchesIntegersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsNotAnIntegerFails() { + // an object is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotAnIntegerFails() { + // an array is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnIntegerFails() { + // null is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsAnIntegerPasses() { + // a float with zero fractional part is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testABooleanIsNotAnIntegerFails() { + // a boolean is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsStillNotAnIntegerEvenIfItLooksLikeOneFails() { + // a string is still not an integer, even if it looks like one + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnIntegerFails() { + // a string is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsAnIntegerPasses() { + // an integer is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAFloatIsNotAnIntegerFails() { + // a float is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.kt new file mode 100644 index 00000000000..66695338367 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails() { + // always invalid, but naive implementations may raise an overflow error + val schema = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0E308, + configuration + ) + } + ) + } + + @Test + fun testValidIntegerWithMultipleofFloatPasses() { + // valid integer with multipleOf float + val schema = InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf.InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf1.getInstance() + schema.validate( + 123456789, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.kt new file mode 100644 index 00000000000..e7883b92b4b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/InvalidStringValueForDefaultTest.kt @@ -0,0 +1,40 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class InvalidStringValueForDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenPropertyIsSpecifiedPasses() { + // valid when property is specified + val schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + "good" + ) + ), + configuration + ) + } + + @Test + fun testStillValidWhenTheInvalidDefaultIsUsedPasses() { + // still valid when the invalid default is used + val schema = InvalidStringValueForDefault.InvalidStringValueForDefault1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt new file mode 100644 index 00000000000..e99e0e709fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv4FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt new file mode 100644 index 00000000000..d80303dcdea --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv6FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt new file mode 100644 index 00000000000..63ed82e2b97 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class JsonPointerFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt new file mode 100644 index 00000000000..d6e53bea2b0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidation.MaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.5, + configuration + ) + } + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 3.0, + configuration + ) + } + + @Test + fun testBelowTheMaximumIsValidPasses() { + // below the maximum is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt new file mode 100644 index 00000000000..f486b09d617 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationWithUnsignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + 300.5, + configuration + ) + } + ) + } + + @Test + fun testBelowTheMaximumIsInvalidPasses() { + // below the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 299.97, + configuration + ) + } + + @Test + fun testBoundaryPointIntegerIsValidPasses() { + // boundary point integer is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300, + configuration + ) + } + + @Test + fun testBoundaryPointFloatIsValidPasses() { + // boundary point float is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300.0, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt new file mode 100644 index 00000000000..01c61a00377 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt new file mode 100644 index 00000000000..dba10dc74cc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt @@ -0,0 +1,68 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "f", + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + 100, + configuration + ) + } + + @Test + fun testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { + // two supplementary Unicode code points is long enough + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "💩💩", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt new file mode 100644 index 00000000000..8c397df7deb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Maxproperties0MeansTheObjectIsEmptyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOnePropertyIsInvalidFails() { + // one property is invalid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoPropertiesIsValidPasses() { + // no properties is valid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt new file mode 100644 index 00000000000..25fe6859ed0 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt @@ -0,0 +1,109 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt new file mode 100644 index 00000000000..3424b61c67d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testBelowTheMinimumIsInvalidFails() { + // below the minimum is invalid + val schema = MinimumValidation.MinimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.6, + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testAboveTheMinimumIsValidPasses() { + // above the minimum is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt new file mode 100644 index 00000000000..a137255840d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt @@ -0,0 +1,92 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationWithSignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointWithFloatIsValidPasses() { + // boundary point with float is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2.0, + configuration + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2, + configuration + ) + } + + @Test + fun testIntBelowTheMinimumIsInvalidFails() { + // int below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -3, + configuration + ) + } + ) + } + + @Test + fun testPositiveAboveTheMinimumIsValidPasses() { + // positive above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + 0, + configuration + ) + } + + @Test + fun testNegativeAboveTheMinimumIsValidPasses() { + // negative above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testFloatBelowTheMinimumIsInvalidFails() { + // float below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -2.0001, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt new file mode 100644 index 00000000000..f6dc4758197 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt @@ -0,0 +1,64 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt new file mode 100644 index 00000000000..f8976f274c1 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "f", + configuration + ) + } + ) + } + + @Test + fun testOneSupplementaryUnicodeCodePointIsNotLongEnoughFails() { + // one supplementary Unicode code point is not long enough + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "💩", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt new file mode 100644 index 00000000000..3c6cd9d15ab --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + "", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..8639f84f58d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAllofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..76f934637ab --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAnyofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt new file mode 100644 index 00000000000..7d7ab246886 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt @@ -0,0 +1,137 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNestedArrayWithInvalidTypeFails() { + // nested array with invalid type + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + listOf( + "1" + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ), + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNotDeepEnoughFails() { + // not deep enough + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + listOf( + 2 + ), + listOf( + 3 + ) + ), + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidNestedArrayPasses() { + // valid nested array + val schema = NestedItems.NestedItems1.getInstance() + schema.validate( + NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ) + ) + .add( + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ) + .build(), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..32e8f394a41 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedOneofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt new file mode 100644 index 00000000000..071a71852c6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotMoreComplexSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOtherMatchPasses() { + // other match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testMismatchFails() { + // mismatch + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchPasses() { + // match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt new file mode 100644 index 00000000000..5b208bae6d7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testDisallowedFails() { + // disallowed + val schema = Not.Not1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllowedPasses() { + // allowed + val schema = Not.Not1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt new file mode 100644 index 00000000000..4aab8da29af --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NulCharactersInStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchStringWithNulPasses() { + // match string with nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + schema.validate( + "hello\u0000there", + configuration + ) + } + + @Test + fun testDoNotMatchStringLackingNulFails() { + // do not match string lacking nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + "hellothere", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt new file mode 100644 index 00000000000..12779200f9c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NullTypeMatchesOnlyTheNullObjectTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testZeroIsNotNullFails() { + // zero is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotNullFails() { + // an array is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotNullFails() { + // an object is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testTrueIsNotNullFails() { + // true is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFalseIsNotNullFails() { + // false is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testNullIsNullPasses() { + // null is null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAStringIsNotNullFails() { + // a string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotNullFails() { + // an integer is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotNullFails() { + // an empty string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotNullFails() { + // a float is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt new file mode 100644 index 00000000000..1ba574586e4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NumberTypeMatchesNumbersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsANumberPasses() { + // a float is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testAnIntegerIsANumberPasses() { + // an integer is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAStringIsStillNotANumberEvenIfItLooksLikeOneFails() { + // a string is still not a number, even if it looks like one + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotANumberFails() { + // a boolean is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { + // a float with zero fractional part is a number (and an integer) + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testNullIsNotANumberFails() { + // null is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotANumberFails() { + // a string is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotANumberFails() { + // an array is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotANumberFails() { + // an object is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt new file mode 100644 index 00000000000..aab7819536b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt @@ -0,0 +1,119 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectPropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothPropertiesPresentAndValidIsValidPasses() { + // both properties present and valid is valid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testDoesnTInvalidateOtherPropertiesPasses() { + // doesn't invalidate other properties + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "quux", + listOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testBothPropertiesInvalidIsInvalidFails() { + // both properties invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + ) + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testOnePropertyInvalidIsInvalidFails() { + // one property invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt new file mode 100644 index 00000000000..16082afdb8d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectTypeMatchesObjectsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsAnObjectPasses() { + // an object is an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAnArrayIsNotAnObjectFails() { + // an array is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnObjectFails() { + // an integer is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAnObjectFails() { + // a boolean is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnObjectFails() { + // a string is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnObjectFails() { + // a float is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnObjectFails() { + // null is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt new file mode 100644 index 00000000000..8f9fb57ea7b --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt @@ -0,0 +1,90 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondOneofValidComplexPasses() { + // second oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothOneofValidComplexFails() { + // both oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testFirstOneofValidComplexPasses() { + // first oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherOneofValidComplexFails() { + // neither oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt new file mode 100644 index 00000000000..012d577b9ec --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testNeitherOneofValidFails() { + // neither oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testSecondOneofValidPasses() { + // second oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } + + @Test + fun testFirstOneofValidPasses() { + // first oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..e5ec716ea82 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneOneofValidPasses() { + // one oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt new file mode 100644 index 00000000000..844584e08c3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOneValidValidPasses() { + // one valid - valid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt new file mode 100644 index 00000000000..da6b03e6370 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithRequiredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFirstValidValidPasses() { + // first valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testSecondValidValidPasses() { + // second valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + + @Test + fun testBothInvalidInvalidFails() { + // both invalid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt new file mode 100644 index 00000000000..3e54785ff69 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternIsNotAnchoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesASubstringPasses() { + // matches a substring + val schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance() + schema.validate( + "xxaayy", + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt new file mode 100644 index 00000000000..0a4d35fd533 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt @@ -0,0 +1,100 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIgnoresBooleansPasses() { + // ignores booleans + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testIgnoresFloatsPasses() { + // ignores floats + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testANonMatchingPatternIsInvalidFails() { + // a non-matching pattern is invalid + val schema = PatternValidation.PatternValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testIgnoresIntegersPasses() { + // ignores integers + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testAMatchingPatternIsValidPasses() { + // a matching pattern is valid + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + "aaa", + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresObjectsPasses() { + // ignores objects + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresNullPasses() { + // ignores null + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + null, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b65f4a4fbd2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithAllNumbersIsValidPasses() { + // object with all numbers is valid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } + + @Test + fun testObjectWithStringsIsInvalidFails() { + // object with strings is invalid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ), + Pair( + "foo\\bar", + "1" + ), + Pair( + "foo\rbar", + "1" + ), + Pair( + "foo\tbar", + "1" + ), + Pair( + "foo\u000Cbar", + "1" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt new file mode 100644 index 00000000000..297e5ed5792 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertyNamedRefThatIsNotAReferenceTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.kt new file mode 100644 index 00000000000..458bb0997f3 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAdditionalpropertiesTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInAdditionalpropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInAdditionalproperties.RefInAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "someProp", + mapOf( + Pair( + "\$ref", + "a" + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInAdditionalproperties.RefInAdditionalproperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "someProp", + mapOf( + Pair( + "\$ref", + 2 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllofTest.kt new file mode 100644 index 00000000000..8d4a5e2b8f5 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAllofTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInAllofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInAllof.RefInAllof1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInAllof.RefInAllof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.kt new file mode 100644 index 00000000000..953bfe69e37 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInAnyofTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInAnyofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInAnyof.RefInAnyof1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInAnyof.RefInAnyof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInItemsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInItemsTest.kt new file mode 100644 index 00000000000..e90b797223d --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInItemsTest.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInItems.RefInItems1.getInstance() + schema.validate( + RefInItems.RefInItemsListBuilder() + .add( + mapOf( + Pair( + "\$ref", + "a" + ) + ) + ) + .build(), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInItems.RefInItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "\$ref", + 2 + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInNotTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInNotTest.kt new file mode 100644 index 00000000000..83eaae28ac7 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInNotTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInNotTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInNot.RefInNot1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInNot.RefInNot1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneofTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneofTest.kt new file mode 100644 index 00000000000..87372d74e73 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInOneofTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInOneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInOneof.RefInOneof1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInOneof.RefInOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.kt new file mode 100644 index 00000000000..e93ab768d2a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RefInPropertyTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RefInPropertyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = RefInProperty.RefInProperty1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + mapOf( + Pair( + "\$ref", + "a" + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = RefInProperty.RefInProperty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a", + mapOf( + Pair( + "\$ref", + 2 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt new file mode 100644 index 00000000000..8512a0f489f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredDefaultValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNotRequiredByDefaultPasses() { + // not required by default + val schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt new file mode 100644 index 00000000000..c5815409b38 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPresentRequiredPropertyIsValidPasses() { + // present required property is valid + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testNonPresentRequiredPropertyIsInvalidFails() { + // non-present required property is invalid + val schema = RequiredValidation.RequiredValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt new file mode 100644 index 00000000000..4f5162d7519 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEmptyArrayTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNotRequiredPasses() { + // property not required + val schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b3b2e3a223f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithSomePropertiesMissingIsInvalidFails() { + // object with some properties missing is invalid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testObjectWithAllPropertiesPresentIsValidPasses() { + // object with all properties present is valid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt new file mode 100644 index 00000000000..88f0fb9321f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SimpleEnumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSomethingElseIsInvalidFails() { + // something else is invalid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 4, + configuration + ) + } + ) + } + + @Test + fun testOneOfTheEnumIsValidPasses() { + // one of the enum is valid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt new file mode 100644 index 00000000000..4c9aafdb869 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class StringTypeMatchesStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { + // a string is still a string, even if it looks like a number + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "1", + configuration + ) + } + + @Test + fun test1IsNotAStringFails() { + // 1 is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAStringFails() { + // a boolean is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsStillAStringPasses() { + // an empty string is still a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testAnArrayIsNotAStringFails() { + // an array is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAStringFails() { + // an object is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAStringFails() { + // null is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsAStringPasses() { + // a string is a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testAFloatIsNotAStringFails() { + // a float is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.kt new file mode 100644 index 00000000000..245ef6aad3f --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest.kt @@ -0,0 +1,59 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissingTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMissingPropertiesAreNotFilledInWithTheDefaultPasses() { + // missing properties are not filled in with the default + val schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAnExplicitPropertyValueIsCheckedAgainstMaximumPassingPasses() { + // an explicit property value is checked against maximum (passing) + val schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance() + schema.validate( + mapOf( + Pair( + "alpha", + 1 + ) + ), + configuration + ) + } + + @Test + fun testAnExplicitPropertyValueIsCheckedAgainstMaximumFailingFails() { + // an explicit property value is checked against maximum (failing) + val schema = TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing.TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "alpha", + 5 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt new file mode 100644 index 00000000000..4c5cff32904 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt @@ -0,0 +1,312 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsFalseValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalPasses() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsValidPasses() { + // non-unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsValidPasses() { + // non-unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsValidPasses() { + // non-unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // 1 and true are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreValidPasses() { + // non-unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // 0 and false are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1 + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsValidPasses() { + // non-unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt new file mode 100644 index 00000000000..6073b139769 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt @@ -0,0 +1,577 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoIntegersIsInvalidFails() { + // non-unique array of more than two integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsInvalidFails() { + // non-unique array of objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testATrueAndA1AreUniquePasses() { + // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + true + ) + ), + mapOf( + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 1 + ), + listOf( + true + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsInvalidFails() { + // non-unique array of integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNested0AndFalseAreUniquePasses() { + // nested [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 0 + ), + "foo" + ), + listOf( + listOf( + false + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testObjectsAreNonUniqueDespiteKeyOrderFails() { + // objects are non-unique despite key order + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "b", + 2 + ), + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsInvalidFails() { + // non-unique array of arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAFalseAndA0AreUniquePasses() { + // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + false + ) + ), + mapOf( + Pair( + "a", + 0 + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { + // non-unique array of more than two arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 0 + ), + listOf( + false + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsInvalidFails() { + // non-unique array of nested objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalFails() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfStringsIsInvalidFails() { + // non-unique array of strings is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + "bar", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNested1AndTrueAreUniquePasses() { + // nested [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + "foo" + ), + listOf( + listOf( + true + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfStringsIsValidPasses() { + // unique array of strings is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + "foo", + "bar", + "baz" + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testDifferentObjectsAreUniquePasses() { + // different objects are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "a", + 2 + ), + Pair( + "b", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1, + "{}" + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreInvalidFails() { + // non-unique heterogeneous types are invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt new file mode 100644 index 00000000000..8ca87fa4aa6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt new file mode 100644 index 00000000000..2eb308a891a --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriReferenceFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt new file mode 100644 index 00000000000..b593a7b2009 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt @@ -0,0 +1,76 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriTemplateFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt new file mode 100644 index 00000000000..cab27673567 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt @@ -0,0 +1,141 @@ +package org.openapijsonschematools.client.configurations; + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaKeywordFlagsTest { + @Test + fun testGetEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + expectedEnabledKeywords.add("additionalProperties") + expectedEnabledKeywords.add("allOf") + expectedEnabledKeywords.add("anyOf") + expectedEnabledKeywords.add("const") + expectedEnabledKeywords.add("contains") + expectedEnabledKeywords.add("dependentRequired") + expectedEnabledKeywords.add("dependentSchemas") + expectedEnabledKeywords.add("discriminator") + expectedEnabledKeywords.add("else_") + expectedEnabledKeywords.add("enum_") + expectedEnabledKeywords.add("exclusiveMaximum") + expectedEnabledKeywords.add("exclusiveMinimum") + expectedEnabledKeywords.add("format") + expectedEnabledKeywords.add("if_") + expectedEnabledKeywords.add("maximum") + expectedEnabledKeywords.add("minimum") + expectedEnabledKeywords.add("items") + expectedEnabledKeywords.add("maxContains") + expectedEnabledKeywords.add("maxItems") + expectedEnabledKeywords.add("maxLength") + expectedEnabledKeywords.add("maxProperties") + expectedEnabledKeywords.add("minContains") + expectedEnabledKeywords.add("minItems") + expectedEnabledKeywords.add("minLength") + expectedEnabledKeywords.add("minProperties") + expectedEnabledKeywords.add("multipleOf") + expectedEnabledKeywords.add("not") + expectedEnabledKeywords.add("oneOf") + expectedEnabledKeywords.add("pattern") + expectedEnabledKeywords.add("patternProperties") + expectedEnabledKeywords.add("prefixItems") + expectedEnabledKeywords.add("properties") + expectedEnabledKeywords.add("propertyNames") + expectedEnabledKeywords.add("required") + expectedEnabledKeywords.add("then") + expectedEnabledKeywords.add("type") + expectedEnabledKeywords.add("uniqueItems") + expectedEnabledKeywords.add("unevaluatedItems") + expectedEnabledKeywords.add("unevaluatedProperties") + assertEquals(enabledKeywords, expectedEnabledKeywords) + } + + @Test + fun testGetNoEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + assertEquals(enabledKeywords, expectedEnabledKeywords) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt new file mode 100644 index 00000000000..74571be8bc2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt @@ -0,0 +1,113 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class AnyTypeSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = schema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateBoolean() { + val trueValue = schema.validate(true, configuration) + assertTrue(trueValue) + val falseValue = schema.validate(false, configuration) + assertFalse(falseValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = schema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = schema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = schema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = schema.validate(70.6458763, configuration) + assertEquals(validatedValue.compareTo(70.6458763).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateString() { + val validatedValue = schema.validate("a", configuration) + assertEquals(validatedValue, "a") + } + + @Test + @Throws(ValidationException::class) + fun testValidateZonedDateTime() { + val validatedValue = + schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration) + assertEquals(validatedValue, "2017-07-21T17:32:28Z") + } + + @Test + @Throws(ValidationException::class) + fun testValidateLocalDate() { + val validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration) + assertEquals(validatedValue, "2017-07-21") + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap = mapOf( + "today" to LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenMap<*> = schema.validate(inMap, configuration) + val outMap: Map = mapOf( + "today" to "2017-07-21" + ) + assertEquals(validatedValue, outMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList = listOf( + LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenList<*> = schema.validate(inList, configuration) + val outList: List = listOf("2017-07-21") + assertEquals(validatedValue, outList) + } + + companion object { + val schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt new file mode 100644 index 00000000000..79c24c6cb44 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt @@ -0,0 +1,251 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ArrayTypeSchemaTest { + sealed interface ArrayWithItemsSchemaBoxed + + data class ArrayWithItemsSchemaBoxedList(val data: FrozenList) : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxedList { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + class ArrayWithOutputClsSchemaList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + return ArrayWithOutputClsSchema().validate(arg, configuration) + } + } + } + + interface ArrayWithOutputClsSchemaBoxed + + data class ArrayWithOutputClsSchemaBoxedList(val data: ArrayWithOutputClsSchemaList) : + ArrayWithOutputClsSchemaBoxed + + class ArrayWithOutputClsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ArrayWithOutputClsSchemaList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + val newInstanceItems = FrozenList(items) + return ArrayWithOutputClsSchemaList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): ArrayWithOutputClsSchemaBoxedList { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithItemsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue: FrozenList = ArrayWithItemsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithItemsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + intList, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithOutputClsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithOutputClsSchema(), + intList, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt new file mode 100644 index 00000000000..4afe62df020 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class BooleanSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = booleanJsonSchema.validate(true, configuration) + assertTrue(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = booleanJsonSchema.validate(false, configuration) + assertFalse(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt new file mode 100644 index 00000000000..6aa74e7b8dc --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt @@ -0,0 +1,55 @@ +package org.openapijsonschematools.client.schemas + +import kotlin.test.Test +import kotlin.test.assertEquals + +class ListBuilderTest { + class NullableListWithNullableItemsListBuilder { + // class to build List<@Nullable List> + private val list: MutableList?> + + constructor() { + list = ArrayList() + } + + constructor(list: MutableList?>) { + this.list = list + } + + fun add(item: Nothing?): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun build(): List?> { + return list + } + } + + @Test + fun testSucceedsWithNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(null) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(null) + assertEquals(inList, builder.build()) + } + + @Test + fun testSucceedsWithNonNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(listOf(1)) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(listOf(1)) + assertEquals(inList, builder.build()) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt new file mode 100644 index 00000000000..494fd110f59 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ListSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList: MutableList = ArrayList() + inList.add("today") + val validatedValue = listJsonSchema.validate(inList, configuration) + val outList: List = listOf("today") + assertEquals(validatedValue, outList) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt new file mode 100644 index 00000000000..bfcd692cb86 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class MapSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap: MutableMap = LinkedHashMap() + inMap["today"] = LocalDate.of(2017, 7, 21) + val validatedValue = mapJsonSchema.validate(inMap, configuration) + val outMap: Map = mapOf("today" to "2017-07-21") + assertEquals(validatedValue, outMap) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt new file mode 100644 index 00000000000..a096b91adf2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.Throws +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class NullSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = nullJsonSchema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + nullJsonSchema, + true, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt new file mode 100644 index 00000000000..db8bd160ce2 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class NumberSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = numberJsonSchema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = numberJsonSchema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = numberJsonSchema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = numberJsonSchema.validate(3.14, configuration) + assertEquals(validatedValue.compareTo(3.14).toLong(), 0) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt new file mode 100644 index 00000000000..a87586e8b15 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt @@ -0,0 +1,569 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ObjectTypeSchemaTest { + interface ObjectWithPropsSchemaBoxed + + data class ObjectWithPropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsSchemaBoxedMap { + return ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsSchemaBoxedMap( + validate(arg, configuration) + ) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + interface ObjectWithAddpropsSchemaBoxed + + data class ObjectWithAddpropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithAddpropsSchemaBoxed {} + + class ObjectWithAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Invalid type for property value") + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithAddpropsSchemaBoxedMap { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithAddpropsSchema().also { instance = it } + } + } + } + + interface ObjectWithPropsAndAddpropsSchemaBoxed + + data class ObjectWithPropsAndAddpropsSchemaBoxedMap(val data: FrozenMap) : + ObjectWithPropsAndAddpropsSchemaBoxed { + } + + class ObjectWithPropsAndAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxedMap { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Any?, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsAndAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsAndAddpropsSchema().also { instance = it } + } + } + } + + class ObjectWithOutputTypeSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration) + } + } + } + + interface ObjectWithOutputTypeSchemaBoxed + + data class ObjectWithOutputTypeSchemaBoxedMap(val data: ObjectWithOutputTypeSchemaMap) : + ObjectWithOutputTypeSchemaBoxed { + } + + class ObjectWithOutputTypeSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ObjectWithOutputTypeSchemaMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return ObjectWithOutputTypeSchemaMap(FrozenMap(properties)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithOutputTypeSchemaBoxedMap { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is FrozenMap<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithOutputTypeSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithOutputTypeSchema().also { instance = it } + } + } + } + + @Test + fun testExceptionThrownForInvalidType() { + val schema = ObjectWithPropsSchema.getInstance() + assertFailsWith( + block = { + JsonSchema.validate( + schema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsSchema() { + val schema = ObjectWithPropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithAddpropsSchema() { + val schema = ObjectWithAddpropsSchema.getInstance() + + // map with only property works + var inMap: MutableMap = LinkedHashMap() + inMap["someString"] = "abc" + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = LinkedHashMap() + inMap["someString"] = "abc" + inMap["someOtherString"] = "def" + validatedValue = schema.validate(inMap, configuration) + outMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap) + + // invalid addProp type fails + val invalidInput = java.util.Map.of("someString", 1) + assertFailsWith( + block = { + JsonSchema.validate( + schema, + invalidInput, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsAndAddpropsSchema() { + val schema = ObjectWithPropsAndAddpropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue: Map = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + inMap = mapOf("someString" to 1) + val invalidPropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidPropMap, configuration + ) + } + ) + + // invalid addProp type fails + inMap = LinkedHashMap() + inMap["someAddProp"] = 1 + val invalidAddpropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidAddpropMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithOutputTypeSchema() { + val schema = ObjectWithOutputTypeSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidInMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidInMap, configuration + ) + } + ) + + // using output class directly works + inMap = mapOf("someString" to "abc") + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration) + val outMap2: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap2) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt new file mode 100644 index 00000000000..651d570e7fb --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class RefBooleanSchemaTest { + class RefBooleanSchema { + class RefBooleanSchema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: RefBooleanSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefBooleanSchema1().also { instance = it } + } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = refBooleanJsonSchema.validate(true, configuration) + assertEquals(validatedValue, true) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = refBooleanJsonSchema.validate(false, configuration) + assertEquals(validatedValue, false) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val refBooleanJsonSchema = JsonSchemaFactory.getInstance(RefBooleanSchema.RefBooleanSchema1::class.java) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt new file mode 100644 index 00000000000..c0add8f2b58 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt @@ -0,0 +1,140 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + + +class AdditionalPropertiesValidatorTest { + sealed interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = "def" + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someAddProp") + + val expectedClasses: LinkedHashMap, Nothing?> = LinkedHashMap() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt new file mode 100644 index 00000000000..89993c589f4 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime + +import kotlin.test.Test +import kotlin.test.assertEquals + +class CustomIsoparserTest { + @Test + fun testParseIsodatetime() { + val dateTime: ZonedDateTime = CustomIsoparser.parseIsodatetime("2017-07-21T17:32:28Z") + val zone = ZoneId.of("Z") + val expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone) + assertEquals(dateTime, expectedDateTime) + } + + @Test + fun testParseIsodate() { + val date: LocalDate = CustomIsoparser.parseIsodate("2017-07-21") + val expectedDate = LocalDate.of(2017, 7, 21) + assertEquals(date, expectedDate) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt new file mode 100644 index 00000000000..be917b8337c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt @@ -0,0 +1,418 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.Int32JsonSchema +import org.openapijsonschematools.client.schemas.Int64JsonSchema +import org.openapijsonschematools.client.schemas.FloatJsonSchema +import org.openapijsonschematools.client.schemas.DoubleJsonSchema +import org.openapijsonschematools.client.schemas.DecimalJsonSchema +import org.openapijsonschematools.client.schemas.DateJsonSchema +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema + +import java.math.BigDecimal +import java.math.BigInteger +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class FormatValidatorTest { + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithFloat() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testIntFormatFailsWithFloat() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithInt() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInt64UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("-9223372036854775809"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + Long.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt64OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("9223372036854775808"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testFloatUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MAX_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testFloatOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testDoubleUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testDoubleOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInvalidNumberStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidFloatNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidIntNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateTimeStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateTimeStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + companion object { + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt new file mode 100644 index 00000000000..a6fd41ebbd8 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt @@ -0,0 +1,120 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class ItemsValidatorTest { + interface ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchemaBoxedList : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + return ArrayWithItemsSchemaBoxedList() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectItemsSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add("a") + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value in pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add(0) + val expectedClasses = LinkedHashMap, Nothing?>() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectItemFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add(1) + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt new file mode 100644 index 00000000000..bad1daff26c --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt @@ -0,0 +1,71 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaTest { + internal sealed interface SomeSchemaBoxed + internal class SomeSchemaBoxedString : SomeSchemaBoxed + internal class SomeSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SomeSchemaBoxed { + return SomeSchemaBoxedString() + } + + companion object { + var instance: SomeSchema? = null + get() { + if (field == null) { + field = SomeSchema() + } + return field + } + private set + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val schema = JsonSchemaFactory.getInstance(SomeSchema::class.java) + val pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ) + val expectedPathToSchemas = PathToSchemasMap() + val validatedClasses = LinkedHashMap, Nothing?>() + validatedClasses[schema] = null + expectedPathToSchemas[pathToItem] = validatedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt new file mode 100644 index 00000000000..086c96448e6 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt @@ -0,0 +1,123 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + +class PropertiesValidatorTest { + interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(MutableMap::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someString") + val expectedClasses = LinkedHashMap, Nothing?>() + expectedClasses[JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java)] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = 1 + val arg = FrozenMap(mutableMap) + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt new file mode 100644 index 00000000000..ba7af366540 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class RequiredValidatorTest { + interface ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchemaBoxedMap : ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .required(setOf("someString")) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithRequiredSchemaBoxed { + return ObjectWithRequiredSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["aDifferentProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt new file mode 100644 index 00000000000..c8049c76683 --- /dev/null +++ b/samples/client/3_0_3_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class TypeValidatorTest { + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemasMap = validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testValidateFailsIntIsNotString() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + assertFailsWith( + block = { + validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md b/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md index 6a63f2af1d2..46058bafc99 100644 --- a/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md +++ b/samples/client/3_1_0_unit_test/java/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md @@ -122,14 +122,14 @@ A class that builds the Map input type ## NonAsciiPatternWithAdditionalpropertiesMap public static class NonAsciiPatternWithAdditionalpropertiesMap
-extends FrozenMap +extends FrozenMap A class to store validated Map payloads ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | ## CircumflexAccentLatinSmallLetterAWithAcuteBoxed public sealed interface CircumflexAccentLatinSmallLetterAWithAcuteBoxed
diff --git a/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md b/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md index bf391634266..7b0d299f2d5 100644 --- a/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md +++ b/samples/client/3_1_0_unit_test/java/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md @@ -110,7 +110,7 @@ PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternprop ## PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder public class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder
-builder for `Map` +builder for `Map` A class that builds the Map input type @@ -122,7 +122,7 @@ A class that builds the Map input type ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| Map | build()
Returns map input that should be used with Schema.validate | +| Map | build()
Returns map input that should be used with Schema.validate | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | foo(List<@Nullable Object> value) | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | bar(List<@Nullable Object> value) | | [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(String key, int value) | @@ -132,14 +132,14 @@ A class that builds the Map input type ## PropertiesPatternpropertiesAdditionalpropertiesInteractionMap public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap
-extends FrozenMap +extends FrozenMap A class to store validated Map payloads ### Method Summary | Modifier and Type | Method and Description | | ----------------- | ---------------------- | -| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | +| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | | FrozenList | foo()
[optional] | | FrozenList | bar()
[optional] | | Number | getAdditionalProperty(String name)
provides type safety for additional properties | diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java index 3a1d5df8000..a9209bbc857 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.java @@ -58,7 +58,7 @@ protected NonAsciiPatternWithAdditionalpropertiesMap(FrozenMap<@Nullable Object> public static final Set requiredKeys = Set.of(); public static final Set optionalKeys = Set.of(); // map with no key value pairs - public static NonAsciiPatternWithAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static NonAsciiPatternWithAdditionalpropertiesMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return NonAsciiPatternWithAdditionalproperties1.getInstance().validate(arg, configuration); } } diff --git a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java index 539e323c402..48fab7f7767 100644 --- a/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java +++ b/samples/client/3_1_0_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.java @@ -435,8 +435,8 @@ public static Bar getInstance() { } - public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap extends FrozenMap { - protected PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(FrozenMap m) { + public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap extends FrozenMap<@Nullable Object> { + protected PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(FrozenMap<@Nullable Object> m) { super(m); } public static final Set requiredKeys = Set.of(); @@ -444,14 +444,14 @@ protected PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(FrozenMa "foo", "bar" ); - public static PropertiesPatternpropertiesAdditionalpropertiesInteractionMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { + public static PropertiesPatternpropertiesAdditionalpropertiesInteractionMap of(Map arg, SchemaConfiguration configuration) throws ValidationException { return PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance().validate(arg, configuration); } public FrozenList foo() throws UnsetPropertyException { String key = "foo"; throwIfKeyNotPresent(key); - Object value = get(key); + @Nullable Object value = get(key); if (!(value instanceof FrozenList)) { throw new RuntimeException("Invalid value stored for foo"); } @@ -461,7 +461,7 @@ public FrozenList foo() throws UnsetPropertyException { public FrozenList bar() throws UnsetPropertyException { String key = "bar"; throwIfKeyNotPresent(key); - Object value = get(key); + @Nullable Object value = get(key); if (!(value instanceof FrozenList)) { throw new RuntimeException("Invalid value stored for bar"); } @@ -479,8 +479,8 @@ public Number getAdditionalProperty(String name) throws UnsetPropertyException, } public interface SetterForFoo { - Map getInstance(); - T getBuilderAfterFoo(Map instance); + Map getInstance(); + T getBuilderAfterFoo(Map instance); default T foo(List<@Nullable Object> value) { var instance = getInstance(); @@ -490,8 +490,8 @@ default T foo(List<@Nullable Object> value) { } public interface SetterForBar { - Map getInstance(); - T getBuilderAfterBar(Map instance); + Map getInstance(); + T getBuilderAfterBar(Map instance); default T bar(List<@Nullable Object> value) { var instance = getInstance(); @@ -502,8 +502,8 @@ default T bar(List<@Nullable Object> value) { public interface SetterForAdditionalProperties { Set getKnownKeys(); - Map getInstance(); - T getBuilderAfterAdditionalProperty(Map instance); + Map getInstance(); + T getBuilderAfterAdditionalProperty(Map instance); default T additionalProperty(String key, int value) throws InvalidAdditionalPropertyException { MapUtils.throwIfKeyKnown(key, getKnownKeys(), true); @@ -534,8 +534,8 @@ default T additionalProperty(String key, double value) throws InvalidAdditionalP } } - public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder implements GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { - private final Map instance; + public static class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder implements GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private final Map instance; private static final Set knownKeys = Set.of( "foo", "bar" @@ -546,19 +546,19 @@ public Set getKnownKeys() { public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder() { this.instance = new LinkedHashMap<>(); } - public Map build() { + public Map build() { return instance; } - public Map getInstance() { + public Map getInstance() { return instance; } - public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterFoo(Map instance) { + public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterFoo(Map instance) { return this; } - public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterBar(Map instance) { + public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterBar(Map instance) { return this; } - public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterAdditionalProperty(Map instance) { + public PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder getBuilderAfterAdditionalProperty(Map instance) { return this; } } @@ -607,7 +607,7 @@ public static PropertiesPatternpropertiesAdditionalpropertiesInteraction1 getIns } public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap getNewInstance(Map arg, List pathToItem, PathToSchemasMap pathToSchemas) { - LinkedHashMap properties = new LinkedHashMap<>(); + LinkedHashMap properties = new LinkedHashMap<>(); for(Map.Entry entry: arg.entrySet()) { @Nullable Object entryKey = entry.getKey(); if (!(entryKey instanceof String)) { @@ -623,12 +623,9 @@ public PropertiesPatternpropertiesAdditionalpropertiesInteractionMap getNewInsta } JsonSchema propertySchema = schemas.entrySet().iterator().next().getKey(); @Nullable Object propertyInstance = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas); - if (!(propertyInstance instanceof Object)) { - throw new RuntimeException("Invalid instantiated value"); - } - properties.put(propertyName, (Object) propertyInstance); + properties.put(propertyName, propertyInstance); } - FrozenMap castProperties = new FrozenMap<>(properties); + FrozenMap<@Nullable Object> castProperties = new FrozenMap<>(properties); return new PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(castProperties); } diff --git a/samples/client/3_1_0_unit_test/kotlin/.gitignore b/samples/client/3_1_0_unit_test/kotlin/.gitignore new file mode 100644 index 00000000000..3a4ec036d04 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.gitignore @@ -0,0 +1,9 @@ +build/ +.gradle/ +.idea/ +target/ + +# gradle wrapper +gradlew +gradlew.bat +gradle/ \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator-ignore b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator-ignore new file mode 100644 index 00000000000..d24a2da8ae5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES new file mode 100644 index 00000000000..3404045da66 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/FILES @@ -0,0 +1,416 @@ +.gitignore +README.md +build.gradle.kts +docs/RootServerInfo.md +docs/components/schemas/ASchemaGivenForPrefixitems.md +docs/components/schemas/AdditionalItemsAreAllowedByDefault.md +docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md +docs/components/schemas/AdditionalpropertiesCanExistByItself.md +docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md +docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/AdditionalpropertiesWithSchema.md +docs/components/schemas/Allof.md +docs/components/schemas/AllofCombinedWithAnyofOneof.md +docs/components/schemas/AllofSimpleTypes.md +docs/components/schemas/AllofWithBaseSchema.md +docs/components/schemas/AllofWithOneEmptySchema.md +docs/components/schemas/AllofWithTheFirstEmptySchema.md +docs/components/schemas/AllofWithTheLastEmptySchema.md +docs/components/schemas/AllofWithTwoEmptySchemas.md +docs/components/schemas/Anyof.md +docs/components/schemas/AnyofComplexTypes.md +docs/components/schemas/AnyofWithBaseSchema.md +docs/components/schemas/AnyofWithOneEmptySchema.md +docs/components/schemas/ArrayTypeMatchesArrays.md +docs/components/schemas/BooleanTypeMatchesBooleans.md +docs/components/schemas/ByInt.md +docs/components/schemas/ByNumber.md +docs/components/schemas/BySmallNumber.md +docs/components/schemas/ConstNulCharactersInStrings.md +docs/components/schemas/ContainsKeywordValidation.md +docs/components/schemas/ContainsWithNullInstanceElements.md +docs/components/schemas/DateFormat.md +docs/components/schemas/DateTimeFormat.md +docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md +docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md +docs/components/schemas/DependentSchemasSingleDependency.md +docs/components/schemas/DurationFormat.md +docs/components/schemas/EmailFormat.md +docs/components/schemas/EmptyDependents.md +docs/components/schemas/EnumWith0DoesNotMatchFalse.md +docs/components/schemas/EnumWith1DoesNotMatchTrue.md +docs/components/schemas/EnumWithEscapedCharacters.md +docs/components/schemas/EnumWithFalseDoesNotMatch0.md +docs/components/schemas/EnumWithTrueDoesNotMatch1.md +docs/components/schemas/EnumsInProperties.md +docs/components/schemas/ExclusivemaximumValidation.md +docs/components/schemas/ExclusiveminimumValidation.md +docs/components/schemas/FloatDivisionInf.md +docs/components/schemas/ForbiddenProperty.md +docs/components/schemas/HostnameFormat.md +docs/components/schemas/IdnEmailFormat.md +docs/components/schemas/IdnHostnameFormat.md +docs/components/schemas/IfAndElseWithoutThen.md +docs/components/schemas/IfAndThenWithoutElse.md +docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md +docs/components/schemas/IgnoreElseWithoutIf.md +docs/components/schemas/IgnoreIfWithoutThenOrElse.md +docs/components/schemas/IgnoreThenWithoutIf.md +docs/components/schemas/IntegerTypeMatchesIntegers.md +docs/components/schemas/Ipv4Format.md +docs/components/schemas/Ipv6Format.md +docs/components/schemas/IriFormat.md +docs/components/schemas/IriReferenceFormat.md +docs/components/schemas/ItemsContains.md +docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md +docs/components/schemas/ItemsWithNullInstanceElements.md +docs/components/schemas/JsonPointerFormat.md +docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md +docs/components/schemas/MaximumValidation.md +docs/components/schemas/MaximumValidationWithUnsignedInteger.md +docs/components/schemas/MaxitemsValidation.md +docs/components/schemas/MaxlengthValidation.md +docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md +docs/components/schemas/MaxpropertiesValidation.md +docs/components/schemas/MincontainsWithoutContainsIsIgnored.md +docs/components/schemas/MinimumValidation.md +docs/components/schemas/MinimumValidationWithSignedInteger.md +docs/components/schemas/MinitemsValidation.md +docs/components/schemas/MinlengthValidation.md +docs/components/schemas/MinpropertiesValidation.md +docs/components/schemas/MultipleDependentsRequired.md +docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md +docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md +docs/components/schemas/NestedAllofToCheckValidationSemantics.md +docs/components/schemas/NestedAnyofToCheckValidationSemantics.md +docs/components/schemas/NestedItems.md +docs/components/schemas/NestedOneofToCheckValidationSemantics.md +docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md +docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md +docs/components/schemas/Not.md +docs/components/schemas/NotMoreComplexSchema.md +docs/components/schemas/NotMultipleTypes.md +docs/components/schemas/NulCharactersInStrings.md +docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md +docs/components/schemas/NumberTypeMatchesNumbers.md +docs/components/schemas/ObjectPropertiesValidation.md +docs/components/schemas/ObjectTypeMatchesObjects.md +docs/components/schemas/Oneof.md +docs/components/schemas/OneofComplexTypes.md +docs/components/schemas/OneofWithBaseSchema.md +docs/components/schemas/OneofWithEmptySchema.md +docs/components/schemas/OneofWithRequired.md +docs/components/schemas/PatternIsNotAnchored.md +docs/components/schemas/PatternValidation.md +docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md +docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md +docs/components/schemas/PrefixitemsWithNullInstanceElements.md +docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md +docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md +docs/components/schemas/PropertiesWithEscapedCharacters.md +docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/PropertyNamedRefThatIsNotAReference.md +docs/components/schemas/PropertynamesValidation.md +docs/components/schemas/RegexFormat.md +docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md +docs/components/schemas/RelativeJsonPointerFormat.md +docs/components/schemas/RequiredDefaultValidation.md +docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md +docs/components/schemas/RequiredValidation.md +docs/components/schemas/RequiredWithEmptyArray.md +docs/components/schemas/RequiredWithEscapedCharacters.md +docs/components/schemas/SimpleEnumValidation.md +docs/components/schemas/SingleDependency.md +docs/components/schemas/SmallMultipleOfLargeInteger.md +docs/components/schemas/StringTypeMatchesStrings.md +docs/components/schemas/TimeFormat.md +docs/components/schemas/TypeArrayObjectOrNull.md +docs/components/schemas/TypeArrayOrObject.md +docs/components/schemas/TypeAsArrayWithOneItem.md +docs/components/schemas/UnevaluateditemsAsSchema.md +docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md +docs/components/schemas/UnevaluateditemsWithItems.md +docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md +docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md +docs/components/schemas/UnevaluatedpropertiesSchema.md +docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md +docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md +docs/components/schemas/UniqueitemsFalseValidation.md +docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md +docs/components/schemas/UniqueitemsValidation.md +docs/components/schemas/UniqueitemsWithAnArrayOfItems.md +docs/components/schemas/UriFormat.md +docs/components/schemas/UriReferenceFormat.md +docs/components/schemas/UriTemplateFormat.md +docs/components/schemas/UuidFormat.md +docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md +docs/servers/RootServer0.md +settings.gradle.kts +src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt +src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt +src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt +src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt +src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt +src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt +src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt +src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt +src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt +src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt diff --git a/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/VERSION b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/VERSION new file mode 100644 index 00000000000..717311e32e3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/.openapi-generator/VERSION @@ -0,0 +1 @@ +unset \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/README.md b/samples/client/3_1_0_unit_test/kotlin/README.md new file mode 100644 index 00000000000..f4fecdfbac4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/README.md @@ -0,0 +1,280 @@ +# unit-test-api +sample spec for testing openapi functionality, built from json schema tests for draft2020-12 + +This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: + +- OpenAPI document version: 0.0.1 +- Kotlin Package version: 0.0.1 +- OpenAPI JSON Schema Generator, Generator: KotlinClientGenerator + +## Requirements + +1. Kotlin 1.9.23 +2. Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +gradle wrapper +gradlew clean build +``` + +### Gradle users + +Add this dependency to your project's build file: + +``` +repositories { + mavenCentral() // Needed if the 'unit-test-api' jar has been published to maven centra + mavenLocal() // Needed if the 'unit-test-api' jar has been published to the local maven repo +} + +dependencies { + implementation "org.openapijsonschematools:unit-test-api:0.0.1" +} +``` + +## Usage Notes +### Validation, Immutability, and Data Type +This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that +- valid data cannot be mutated and become invalid to a set of schemas + - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable + +Here is the mapping from json schema types to Kotlin types: + +| Json Schema Type | Kotlin Base Class | +| ---------------- | --------------- | +| object | FrozenMap (Map) | +| array | FrozenList (List) | +| string | String | +| number | Number (Int, Long, Float, Double) | +| integer | Int, Long, Float, Double (with values equal to integers) | +| boolean | Boolean | +| null | Nothing? (null) | +| AnyType (unset) | Any? | + +### Storage of Json Schema Definition in Kotlin JsonSchema Classes +In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if +type is unset. I have chosen to separate the storage of +- json schema definition info +- output classes for validated Map (json schema type object) payloads +- output classes for validated List (json schema type array) payloads + +
+ Reason + +This json schema data is stored in each class that is written for a schema, in a component or +other openapi document location. This class is only responsible for storing schema info. +Output classes like those that store map payloads are written separately and are +returned by the JsonSchema.validate method when that method is passed in Map input. +This prevents payload property access methods from +colliding with json schema definition. +
+ +### Json Schema Type Object +Most component schemas (models) are probably of type object. Which is a map data structure. +Json schema allows string keys in this map, which means schema properties can have key names that are +invalid Kotlin variable names. Names like: +- "hi-there" +- "1variable" +- "@now" +- " " +- "from" + +To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. +This means that one can use normal Map methods on instances of these classes. + +
+ Other Details + +- getters are written for validly named required and optional properties +- null is only allowed in as a value if type: "null" was included or nullable: true was set + - because null is an allowed property value, it is not used to represent an unset property state +- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown +
+ +### Json Schema Type + Format, Validated Data Storage +N schemas can be validated on the same payload. +To allow multiple schemas to validate, the data must be stored using one base class whether or not +a json schema format constraint exists in the schema. + +In json schema, type: number with no format validates both integers and floats, +so int and float values are stored for type number. + +
+ String + Date Example + +For example the string payload '2023-12-20' is validates to both of these schemas: +1. string only +``` +- type: string +``` +2. string and date format +``` +- type: string + format: date +``` +Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data +is stored as a string. +
+ +## Getting Started + +Please follow the [installation procedure](#installation) and then use the JsonSchema classes in +org.openapijsonschematools.client.components.schemas to validate input payloads and instances of validated Map and List +output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have +allowed input and output types. + +## Servers +| server_index | Class | Description | +| ------------ | ----- | ----------- | +| 0 | [RootServer0](docs/servers/RootServer0.md) | | + +## Component Schemas +| Class | Description | +| ----- | ----------- | +| [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1](docs/components/schemas/ASchemaGivenForPrefixitems.md#aschemagivenforprefixitems1) | | +| [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1](docs/components/schemas/AdditionalItemsAreAllowedByDefault.md#additionalitemsareallowedbydefault1) | | +| [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md#additionalpropertiesareallowedbydefault1) | | +| [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](docs/components/schemas/AdditionalpropertiesCanExistByItself.md#additionalpropertiescanexistbyitself1) | | +| [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1](docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md#additionalpropertiesdoesnotlookinapplicators1) | | +| [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1](docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md#additionalpropertieswithnullvaluedinstanceproperties1) | | +| [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1](docs/components/schemas/AdditionalpropertiesWithSchema.md#additionalpropertieswithschema1) | | +| [Allof.Allof1](docs/components/schemas/Allof.md#allof1) | | +| [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](docs/components/schemas/AllofCombinedWithAnyofOneof.md#allofcombinedwithanyofoneof1) | | +| [AllofSimpleTypes.AllofSimpleTypes1](docs/components/schemas/AllofSimpleTypes.md#allofsimpletypes1) | | +| [AllofWithBaseSchema.AllofWithBaseSchema1](docs/components/schemas/AllofWithBaseSchema.md#allofwithbaseschema1) | | +| [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](docs/components/schemas/AllofWithOneEmptySchema.md#allofwithoneemptyschema1) | | +| [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](docs/components/schemas/AllofWithTheFirstEmptySchema.md#allofwiththefirstemptyschema1) | | +| [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](docs/components/schemas/AllofWithTheLastEmptySchema.md#allofwiththelastemptyschema1) | | +| [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](docs/components/schemas/AllofWithTwoEmptySchemas.md#allofwithtwoemptyschemas1) | | +| [Anyof.Anyof1](docs/components/schemas/Anyof.md#anyof1) | | +| [AnyofComplexTypes.AnyofComplexTypes1](docs/components/schemas/AnyofComplexTypes.md#anyofcomplextypes1) | | +| [AnyofWithBaseSchema.AnyofWithBaseSchema1](docs/components/schemas/AnyofWithBaseSchema.md#anyofwithbaseschema1) | | +| [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](docs/components/schemas/AnyofWithOneEmptySchema.md#anyofwithoneemptyschema1) | | +| [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](docs/components/schemas/ArrayTypeMatchesArrays.md#arraytypematchesarrays1) | | +| [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](docs/components/schemas/BooleanTypeMatchesBooleans.md#booleantypematchesbooleans1) | | +| [ByInt.ByInt1](docs/components/schemas/ByInt.md#byint1) | | +| [ByNumber.ByNumber1](docs/components/schemas/ByNumber.md#bynumber1) | | +| [BySmallNumber.BySmallNumber1](docs/components/schemas/BySmallNumber.md#bysmallnumber1) | | +| [ConstNulCharactersInStrings.ConstNulCharactersInStrings1](docs/components/schemas/ConstNulCharactersInStrings.md#constnulcharactersinstrings1) | | +| [ContainsKeywordValidation.ContainsKeywordValidation1](docs/components/schemas/ContainsKeywordValidation.md#containskeywordvalidation1) | | +| [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1](docs/components/schemas/ContainsWithNullInstanceElements.md#containswithnullinstanceelements1) | | +| [DateFormat.DateFormat1](docs/components/schemas/DateFormat.md#dateformat1) | | +| [DateTimeFormat.DateTimeFormat1](docs/components/schemas/DateTimeFormat.md#datetimeformat1) | | +| [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1](docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md#dependentschemasdependencieswithescapedcharacters1) | | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1](docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md#dependentschemasdependentsubschemaincompatiblewithroot1) | | +| [DependentSchemasSingleDependency.DependentSchemasSingleDependency1](docs/components/schemas/DependentSchemasSingleDependency.md#dependentschemassingledependency1) | | +| [DurationFormat.DurationFormat1](docs/components/schemas/DurationFormat.md#durationformat1) | | +| [EmailFormat.EmailFormat1](docs/components/schemas/EmailFormat.md#emailformat1) | | +| [EmptyDependents.EmptyDependents1](docs/components/schemas/EmptyDependents.md#emptydependents1) | | +| [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](docs/components/schemas/EnumWith0DoesNotMatchFalse.md#enumwith0doesnotmatchfalse1) | | +| [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](docs/components/schemas/EnumWith1DoesNotMatchTrue.md#enumwith1doesnotmatchtrue1) | | +| [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](docs/components/schemas/EnumWithEscapedCharacters.md#enumwithescapedcharacters1) | | +| [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](docs/components/schemas/EnumWithFalseDoesNotMatch0.md#enumwithfalsedoesnotmatch01) | | +| [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](docs/components/schemas/EnumWithTrueDoesNotMatch1.md#enumwithtruedoesnotmatch11) | | +| [EnumsInProperties.EnumsInProperties1](docs/components/schemas/EnumsInProperties.md#enumsinproperties1) | | +| [ExclusivemaximumValidation.ExclusivemaximumValidation1](docs/components/schemas/ExclusivemaximumValidation.md#exclusivemaximumvalidation1) | | +| [ExclusiveminimumValidation.ExclusiveminimumValidation1](docs/components/schemas/ExclusiveminimumValidation.md#exclusiveminimumvalidation1) | | +| [FloatDivisionInf.FloatDivisionInf1](docs/components/schemas/FloatDivisionInf.md#floatdivisioninf1) | | +| [ForbiddenProperty.ForbiddenProperty1](docs/components/schemas/ForbiddenProperty.md#forbiddenproperty1) | | +| [HostnameFormat.HostnameFormat1](docs/components/schemas/HostnameFormat.md#hostnameformat1) | | +| [IdnEmailFormat.IdnEmailFormat1](docs/components/schemas/IdnEmailFormat.md#idnemailformat1) | | +| [IdnHostnameFormat.IdnHostnameFormat1](docs/components/schemas/IdnHostnameFormat.md#idnhostnameformat1) | | +| [IfAndElseWithoutThen.IfAndElseWithoutThen1](docs/components/schemas/IfAndElseWithoutThen.md#ifandelsewithoutthen1) | | +| [IfAndThenWithoutElse.IfAndThenWithoutElse1](docs/components/schemas/IfAndThenWithoutElse.md#ifandthenwithoutelse1) | | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1](docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md#ifappearsattheendwhenserializedkeywordprocessingsequence1) | | +| [IgnoreElseWithoutIf.IgnoreElseWithoutIf1](docs/components/schemas/IgnoreElseWithoutIf.md#ignoreelsewithoutif1) | | +| [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1](docs/components/schemas/IgnoreIfWithoutThenOrElse.md#ignoreifwithoutthenorelse1) | | +| [IgnoreThenWithoutIf.IgnoreThenWithoutIf1](docs/components/schemas/IgnoreThenWithoutIf.md#ignorethenwithoutif1) | | +| [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](docs/components/schemas/IntegerTypeMatchesIntegers.md#integertypematchesintegers1) | | +| [Ipv4Format.Ipv4Format1](docs/components/schemas/Ipv4Format.md#ipv4format1) | | +| [Ipv6Format.Ipv6Format1](docs/components/schemas/Ipv6Format.md#ipv6format1) | | +| [IriFormat.IriFormat1](docs/components/schemas/IriFormat.md#iriformat1) | | +| [IriReferenceFormat.IriReferenceFormat1](docs/components/schemas/IriReferenceFormat.md#irireferenceformat1) | | +| [ItemsContains.ItemsContains1](docs/components/schemas/ItemsContains.md#itemscontains1) | | +| [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1](docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md#itemsdoesnotlookinapplicatorsvalidcase1) | | +| [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1](docs/components/schemas/ItemsWithNullInstanceElements.md#itemswithnullinstanceelements1) | | +| [JsonPointerFormat.JsonPointerFormat1](docs/components/schemas/JsonPointerFormat.md#jsonpointerformat1) | | +| [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1](docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md#maxcontainswithoutcontainsisignored1) | | +| [MaximumValidation.MaximumValidation1](docs/components/schemas/MaximumValidation.md#maximumvalidation1) | | +| [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](docs/components/schemas/MaximumValidationWithUnsignedInteger.md#maximumvalidationwithunsignedinteger1) | | +| [MaxitemsValidation.MaxitemsValidation1](docs/components/schemas/MaxitemsValidation.md#maxitemsvalidation1) | | +| [MaxlengthValidation.MaxlengthValidation1](docs/components/schemas/MaxlengthValidation.md#maxlengthvalidation1) | | +| [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md#maxproperties0meanstheobjectisempty1) | | +| [MaxpropertiesValidation.MaxpropertiesValidation1](docs/components/schemas/MaxpropertiesValidation.md#maxpropertiesvalidation1) | | +| [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1](docs/components/schemas/MincontainsWithoutContainsIsIgnored.md#mincontainswithoutcontainsisignored1) | | +| [MinimumValidation.MinimumValidation1](docs/components/schemas/MinimumValidation.md#minimumvalidation1) | | +| [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](docs/components/schemas/MinimumValidationWithSignedInteger.md#minimumvalidationwithsignedinteger1) | | +| [MinitemsValidation.MinitemsValidation1](docs/components/schemas/MinitemsValidation.md#minitemsvalidation1) | | +| [MinlengthValidation.MinlengthValidation1](docs/components/schemas/MinlengthValidation.md#minlengthvalidation1) | | +| [MinpropertiesValidation.MinpropertiesValidation1](docs/components/schemas/MinpropertiesValidation.md#minpropertiesvalidation1) | | +| [MultipleDependentsRequired.MultipleDependentsRequired1](docs/components/schemas/MultipleDependentsRequired.md#multipledependentsrequired1) | | +| [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1](docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md#multiplesimultaneouspatternpropertiesarevalidated1) | | +| [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1](docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md#multipletypescanbespecifiedinanarray1) | | +| [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](docs/components/schemas/NestedAllofToCheckValidationSemantics.md#nestedalloftocheckvalidationsemantics1) | | +| [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](docs/components/schemas/NestedAnyofToCheckValidationSemantics.md#nestedanyoftocheckvalidationsemantics1) | | +| [NestedItems.NestedItems1](docs/components/schemas/NestedItems.md#nesteditems1) | | +| [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](docs/components/schemas/NestedOneofToCheckValidationSemantics.md#nestedoneoftocheckvalidationsemantics1) | | +| [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1](docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md#nonasciipatternwithadditionalproperties1) | | +| [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1](docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md#noninterferenceacrosscombinedschemas1) | | +| [Not.Not1](docs/components/schemas/Not.md#not1) | | +| [NotMoreComplexSchema.NotMoreComplexSchema1](docs/components/schemas/NotMoreComplexSchema.md#notmorecomplexschema1) | | +| [NotMultipleTypes.NotMultipleTypes1](docs/components/schemas/NotMultipleTypes.md#notmultipletypes1) | | +| [NulCharactersInStrings.NulCharactersInStrings1](docs/components/schemas/NulCharactersInStrings.md#nulcharactersinstrings1) | | +| [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md#nulltypematchesonlythenullobject1) | | +| [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](docs/components/schemas/NumberTypeMatchesNumbers.md#numbertypematchesnumbers1) | | +| [ObjectPropertiesValidation.ObjectPropertiesValidation1](docs/components/schemas/ObjectPropertiesValidation.md#objectpropertiesvalidation1) | | +| [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](docs/components/schemas/ObjectTypeMatchesObjects.md#objecttypematchesobjects1) | | +| [Oneof.Oneof1](docs/components/schemas/Oneof.md#oneof1) | | +| [OneofComplexTypes.OneofComplexTypes1](docs/components/schemas/OneofComplexTypes.md#oneofcomplextypes1) | | +| [OneofWithBaseSchema.OneofWithBaseSchema1](docs/components/schemas/OneofWithBaseSchema.md#oneofwithbaseschema1) | | +| [OneofWithEmptySchema.OneofWithEmptySchema1](docs/components/schemas/OneofWithEmptySchema.md#oneofwithemptyschema1) | | +| [OneofWithRequired.OneofWithRequired1](docs/components/schemas/OneofWithRequired.md#oneofwithrequired1) | | +| [PatternIsNotAnchored.PatternIsNotAnchored1](docs/components/schemas/PatternIsNotAnchored.md#patternisnotanchored1) | | +| [PatternValidation.PatternValidation1](docs/components/schemas/PatternValidation.md#patternvalidation1) | | +| [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1](docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md#patternpropertiesvalidatespropertiesmatchingaregex1) | | +| [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1](docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md#patternpropertieswithnullvaluedinstanceproperties1) | | +| [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1](docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md#prefixitemsvalidationadjuststhestartingindexforitems1) | | +| [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1](docs/components/schemas/PrefixitemsWithNullInstanceElements.md#prefixitemswithnullinstanceelements1) | | +| [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1](docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md#propertiespatternpropertiesadditionalpropertiesinteraction1) | | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1](docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md#propertieswhosenamesarejavascriptobjectpropertynames1) | | +| [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](docs/components/schemas/PropertiesWithEscapedCharacters.md#propertieswithescapedcharacters1) | | +| [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1](docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md#propertieswithnullvaluedinstanceproperties1) | | +| [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](docs/components/schemas/PropertyNamedRefThatIsNotAReference.md#propertynamedrefthatisnotareference1) | | +| [PropertynamesValidation.PropertynamesValidation1](docs/components/schemas/PropertynamesValidation.md#propertynamesvalidation1) | | +| [RegexFormat.RegexFormat1](docs/components/schemas/RegexFormat.md#regexformat1) | | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1](docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md#regexesarenotanchoredbydefaultandarecasesensitive1) | | +| [RelativeJsonPointerFormat.RelativeJsonPointerFormat1](docs/components/schemas/RelativeJsonPointerFormat.md#relativejsonpointerformat1) | | +| [RequiredDefaultValidation.RequiredDefaultValidation1](docs/components/schemas/RequiredDefaultValidation.md#requireddefaultvalidation1) | | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1](docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md#requiredpropertieswhosenamesarejavascriptobjectpropertynames1) | | +| [RequiredValidation.RequiredValidation1](docs/components/schemas/RequiredValidation.md#requiredvalidation1) | | +| [RequiredWithEmptyArray.RequiredWithEmptyArray1](docs/components/schemas/RequiredWithEmptyArray.md#requiredwithemptyarray1) | | +| [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](docs/components/schemas/RequiredWithEscapedCharacters.md#requiredwithescapedcharacters1) | | +| [SimpleEnumValidation.SimpleEnumValidation1](docs/components/schemas/SimpleEnumValidation.md#simpleenumvalidation1) | | +| [SingleDependency.SingleDependency1](docs/components/schemas/SingleDependency.md#singledependency1) | | +| [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1](docs/components/schemas/SmallMultipleOfLargeInteger.md#smallmultipleoflargeinteger1) | | +| [StringTypeMatchesStrings.StringTypeMatchesStrings1](docs/components/schemas/StringTypeMatchesStrings.md#stringtypematchesstrings1) | | +| [TimeFormat.TimeFormat1](docs/components/schemas/TimeFormat.md#timeformat1) | | +| [TypeArrayObjectOrNull.TypeArrayObjectOrNull1](docs/components/schemas/TypeArrayObjectOrNull.md#typearrayobjectornull1) | | +| [TypeArrayOrObject.TypeArrayOrObject1](docs/components/schemas/TypeArrayOrObject.md#typearrayorobject1) | | +| [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1](docs/components/schemas/TypeAsArrayWithOneItem.md#typeasarraywithoneitem1) | | +| [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1](docs/components/schemas/UnevaluateditemsAsSchema.md#unevaluateditemsasschema1) | | +| [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1](docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md#unevaluateditemsdependsonmultiplenestedcontains1) | | +| [UnevaluateditemsWithItems.UnevaluateditemsWithItems1](docs/components/schemas/UnevaluateditemsWithItems.md#unevaluateditemswithitems1) | | +| [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1](docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md#unevaluateditemswithnullinstanceelements1) | | +| [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1](docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md#unevaluatedpropertiesnotaffectedbypropertynames1) | | +| [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1](docs/components/schemas/UnevaluatedpropertiesSchema.md#unevaluatedpropertiesschema1) | | +| [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1](docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md#unevaluatedpropertieswithadjacentadditionalproperties1) | | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1](docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md#unevaluatedpropertieswithnullvaluedinstanceproperties1) | | +| [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](docs/components/schemas/UniqueitemsFalseValidation.md#uniqueitemsfalsevalidation1) | | +| [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1](docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md#uniqueitemsfalsewithanarrayofitems1) | | +| [UniqueitemsValidation.UniqueitemsValidation1](docs/components/schemas/UniqueitemsValidation.md#uniqueitemsvalidation1) | | +| [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1](docs/components/schemas/UniqueitemsWithAnArrayOfItems.md#uniqueitemswithanarrayofitems1) | | +| [UriFormat.UriFormat1](docs/components/schemas/UriFormat.md#uriformat1) | | +| [UriReferenceFormat.UriReferenceFormat1](docs/components/schemas/UriReferenceFormat.md#urireferenceformat1) | | +| [UriTemplateFormat.UriTemplateFormat1](docs/components/schemas/UriTemplateFormat.md#uritemplateformat1) | | +| [UuidFormat.UuidFormat1](docs/components/schemas/UuidFormat.md#uuidformat1) | | +| [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1](docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md#validateagainstcorrectbranchthenvselse1) | | diff --git a/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts new file mode 100644 index 00000000000..882b3b35624 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + kotlin("jvm") version "1.9.23" +} + +repositories { + mavenLocal() + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } +} + +dependencies { + implementation(kotlin("reflect")) + testImplementation(kotlin("test")) + implementation("org.checkerframework:checker-qual:3.42.0") + implementation("com.google.code.gson:gson:2.10.1") + testImplementation("junit:junit:4.13.2") +} + +group = "org.openapijsonschematools" +version = "0.0.1" +description = "OpenAPI Kotlin" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + +tasks.wrapper { + gradleVersion = "8.1.1" +} + +tasks.compileKotlin { + kotlinDaemonJvmArguments.add("-Xmx1g") +} + +tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/RootServerInfo.md b/samples/client/3_1_0_unit_test/kotlin/docs/RootServerInfo.md new file mode 100644 index 00000000000..46c3ca818e6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/RootServerInfo.md @@ -0,0 +1,59 @@ +# RootServerInfo +RootServerInfo.java + +public class RootServerInfo + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [RootServerInfo.RootServerInfo1](#rootserverinfo1)
class that stores a server index | +| static class | [RootServerInfo.RootServerInfoBuilder](#rootserverinfobuilder)
class that stores a server index | +| enum | [RootServerInfo.ServerIndex](#serverindex)
class that stores a server index | + +## RootServerInfo1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfo1(@Nullable [RootServer0](servers/RootServer0.md) server0)
Creates an instance using passed in servers | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| [RootServer0](servers/RootServer0.md) | server0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + +## RootServerInfoBuilder + +a builder for [RootServerInfo1](#rootserverinfo1) + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServerInfoBuilder()
Creates an instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RootServerInfoBuilder](#rootserverinfobuilder) | rootServer0([RootServer0](servers/RootServer0.md) server0)
sets the server | +| [RootServerInfo1](#rootserverinfo1) | build() | + +## ServerIndex +enum ServerIndex
+ +### Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +| SERVER_0
server 0 | diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ASchemaGivenForPrefixitems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ASchemaGivenForPrefixitems.md new file mode 100644 index 00000000000..56481399a71 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ASchemaGivenForPrefixitems.md @@ -0,0 +1,286 @@ +# ASchemaGivenForPrefixitems +org.openapijsonschematools.client.components.schemas.ASchemaGivenForPrefixitems.java +class ASchemaGivenForPrefixitems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed)
sealed interface for validated payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedVoid](#aschemagivenforprefixitems1boxedvoid)
boxed class to store validated null payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedBoolean](#aschemagivenforprefixitems1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedNumber](#aschemagivenforprefixitems1boxednumber)
boxed class to store validated Number payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedString](#aschemagivenforprefixitems1boxedstring)
boxed class to store validated String payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedList](#aschemagivenforprefixitems1boxedlist)
boxed class to store validated List payloads | +| record | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1BoxedMap](#aschemagivenforprefixitems1boxedmap)
boxed class to store validated Map payloads | +| static class | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1](#aschemagivenforprefixitems1)
schema class | +| sealed interface | [ASchemaGivenForPrefixitems.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [ASchemaGivenForPrefixitems.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| static class | [ASchemaGivenForPrefixitems.Schema1](#schema1)
schema class | +| sealed interface | [ASchemaGivenForPrefixitems.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [ASchemaGivenForPrefixitems.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [ASchemaGivenForPrefixitems.Schema0](#schema0)
schema class | +| static class | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder](#aschemagivenforprefixitemslistbuilder)
builder for List payloads | +| static class | [ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist)
output class for List payloads | + +## ASchemaGivenForPrefixitems1Boxed +sealed interface ASchemaGivenForPrefixitems1Boxed
+permits
+[ASchemaGivenForPrefixitems1BoxedVoid](#aschemagivenforprefixitems1boxedvoid), +[ASchemaGivenForPrefixitems1BoxedBoolean](#aschemagivenforprefixitems1boxedboolean), +[ASchemaGivenForPrefixitems1BoxedNumber](#aschemagivenforprefixitems1boxednumber), +[ASchemaGivenForPrefixitems1BoxedString](#aschemagivenforprefixitems1boxedstring), +[ASchemaGivenForPrefixitems1BoxedList](#aschemagivenforprefixitems1boxedlist), +[ASchemaGivenForPrefixitems1BoxedMap](#aschemagivenforprefixitems1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ASchemaGivenForPrefixitems1BoxedVoid +data class ASchemaGivenForPrefixitems1BoxedVoid
+implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ASchemaGivenForPrefixitems1BoxedBoolean +data class ASchemaGivenForPrefixitems1BoxedBoolean
+implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ASchemaGivenForPrefixitems1BoxedNumber +data class ASchemaGivenForPrefixitems1BoxedNumber
+implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ASchemaGivenForPrefixitems1BoxedString +data class ASchemaGivenForPrefixitems1BoxedString
+implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ASchemaGivenForPrefixitems1BoxedList +data class ASchemaGivenForPrefixitems1BoxedList
+implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedList([ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## ASchemaGivenForPrefixitems1BoxedMap +data class ASchemaGivenForPrefixitems1BoxedMap
+implements [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitems1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ASchemaGivenForPrefixitems1 +class ASchemaGivenForPrefixitems1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | prefixItems = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) | validate(arg: [List<*>](#aschemagivenforprefixitemslistbuilder), configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedString](#aschemagivenforprefixitems1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedVoid](#aschemagivenforprefixitems1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedNumber](#aschemagivenforprefixitems1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedBoolean](#aschemagivenforprefixitems1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedMap](#aschemagivenforprefixitems1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1BoxedList](#aschemagivenforprefixitems1boxedlist) | validateAndBox([List<*>](#aschemagivenforprefixitemslistbuilder), configuration: SchemaConfiguration) | +| [ASchemaGivenForPrefixitems1Boxed](#aschemagivenforprefixitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedString](#schema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ASchemaGivenForPrefixitemsListBuilder +class ASchemaGivenForPrefixitemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ASchemaGivenForPrefixitemsListBuilder()
Creates an empty list | +| ASchemaGivenForPrefixitemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Nothing?) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Boolean) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: String) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Int) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Float) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Long) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Double) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: List) | +| ASchemaGivenForPrefixitemsListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ASchemaGivenForPrefixitemsList +class ASchemaGivenForPrefixitemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ASchemaGivenForPrefixitemsList](#aschemagivenforprefixitemslist) | of([List](#aschemagivenforprefixitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalItemsAreAllowedByDefault.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalItemsAreAllowedByDefault.md new file mode 100644 index 00000000000..6d51e715f12 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalItemsAreAllowedByDefault.md @@ -0,0 +1,248 @@ +# AdditionalItemsAreAllowedByDefault +org.openapijsonschematools.client.components.schemas.AdditionalItemsAreAllowedByDefault.java +class AdditionalItemsAreAllowedByDefault
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed)
sealed interface for validated payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedVoid](#additionalitemsareallowedbydefault1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedBoolean](#additionalitemsareallowedbydefault1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedNumber](#additionalitemsareallowedbydefault1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedString](#additionalitemsareallowedbydefault1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedList](#additionalitemsareallowedbydefault1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1BoxedMap](#additionalitemsareallowedbydefault1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1](#additionalitemsareallowedbydefault1)
schema class | +| sealed interface | [AdditionalItemsAreAllowedByDefault.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AdditionalItemsAreAllowedByDefault.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [AdditionalItemsAreAllowedByDefault.Schema0](#schema0)
schema class | +| static class | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefaultListBuilder](#additionalitemsareallowedbydefaultlistbuilder)
builder for List payloads | +| static class | [AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist)
output class for List payloads | + +## AdditionalItemsAreAllowedByDefault1Boxed +sealed interface AdditionalItemsAreAllowedByDefault1Boxed
+permits
+[AdditionalItemsAreAllowedByDefault1BoxedVoid](#additionalitemsareallowedbydefault1boxedvoid), +[AdditionalItemsAreAllowedByDefault1BoxedBoolean](#additionalitemsareallowedbydefault1boxedboolean), +[AdditionalItemsAreAllowedByDefault1BoxedNumber](#additionalitemsareallowedbydefault1boxednumber), +[AdditionalItemsAreAllowedByDefault1BoxedString](#additionalitemsareallowedbydefault1boxedstring), +[AdditionalItemsAreAllowedByDefault1BoxedList](#additionalitemsareallowedbydefault1boxedlist), +[AdditionalItemsAreAllowedByDefault1BoxedMap](#additionalitemsareallowedbydefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalItemsAreAllowedByDefault1BoxedVoid +data class AdditionalItemsAreAllowedByDefault1BoxedVoid
+implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedBoolean +data class AdditionalItemsAreAllowedByDefault1BoxedBoolean
+implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedNumber +data class AdditionalItemsAreAllowedByDefault1BoxedNumber
+implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedString +data class AdditionalItemsAreAllowedByDefault1BoxedString
+implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedList +data class AdditionalItemsAreAllowedByDefault1BoxedList
+implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedList([AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalItemsAreAllowedByDefault1BoxedMap +data class AdditionalItemsAreAllowedByDefault1BoxedMap
+implements [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefault1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalItemsAreAllowedByDefault1 +class AdditionalItemsAreAllowedByDefault1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | prefixItems = listOf(
    [Schema0::class.java](#schema0)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) | validate(arg: [List<*>](#additionalitemsareallowedbydefaultlistbuilder), configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedString](#additionalitemsareallowedbydefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedVoid](#additionalitemsareallowedbydefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedNumber](#additionalitemsareallowedbydefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedBoolean](#additionalitemsareallowedbydefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedMap](#additionalitemsareallowedbydefault1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1BoxedList](#additionalitemsareallowedbydefault1boxedlist) | validateAndBox([List<*>](#additionalitemsareallowedbydefaultlistbuilder), configuration: SchemaConfiguration) | +| [AdditionalItemsAreAllowedByDefault1Boxed](#additionalitemsareallowedbydefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalItemsAreAllowedByDefaultListBuilder +class AdditionalItemsAreAllowedByDefaultListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalItemsAreAllowedByDefaultListBuilder()
Creates an empty list | +| AdditionalItemsAreAllowedByDefaultListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Nothing?) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Boolean) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: String) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Int) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Float) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Long) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Double) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: List) | +| AdditionalItemsAreAllowedByDefaultListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## AdditionalItemsAreAllowedByDefaultList +class AdditionalItemsAreAllowedByDefaultList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalItemsAreAllowedByDefaultList](#additionalitemsareallowedbydefaultlist) | of([List](#additionalitemsareallowedbydefaultlistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md new file mode 100644 index 00000000000..c3785564640 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md @@ -0,0 +1,496 @@ +# AdditionalpropertiesAreAllowedByDefault +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesAreAllowedByDefault.java +class AdditionalpropertiesAreAllowedByDefault
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1](#additionalpropertiesareallowedbydefault1)
schema class | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Bar](#bar)
schema class | +| sealed interface | [AdditionalpropertiesAreAllowedByDefault.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesAreAllowedByDefault.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesAreAllowedByDefault.Foo](#foo)
schema class | + +## AdditionalpropertiesAreAllowedByDefault1Boxed +sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed
+permits
+[AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid), +[AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean), +[AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber), +[AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring), +[AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist), +[AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesAreAllowedByDefault1BoxedVoid +data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedBoolean +data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedNumber +data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedString +data class AdditionalpropertiesAreAllowedByDefault1BoxedString
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedList +data class AdditionalpropertiesAreAllowedByDefault1BoxedList
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1BoxedMap +data class AdditionalpropertiesAreAllowedByDefault1BoxedMap
+implements [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefault1BoxedMap([AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesAreAllowedByDefault1 +class AdditionalpropertiesAreAllowedByDefault1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | validate(arg: [Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedString](#additionalpropertiesareallowedbydefault1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedVoid](#additionalpropertiesareallowedbydefault1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedNumber](#additionalpropertiesareallowedbydefault1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedBoolean](#additionalpropertiesareallowedbydefault1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedMap](#additionalpropertiesareallowedbydefault1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesareallowedbydefaultmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1BoxedList](#additionalpropertiesareallowedbydefault1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesAreAllowedByDefault1Boxed](#additionalpropertiesareallowedbydefault1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesAreAllowedByDefaultMapBuilder +class AdditionalpropertiesAreAllowedByDefaultMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesAreAllowedByDefaultMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | foo(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | bar(value: Map) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: String) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Int) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Float) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Long) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Double) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: List) | +| [AdditionalpropertiesAreAllowedByDefaultMapBuilder](#additionalpropertiesareallowedbydefaultmapbuilder) | additionalProperty(key: String, value: Map) | + +## AdditionalpropertiesAreAllowedByDefaultMap +class AdditionalpropertiesAreAllowedByDefaultMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesAreAllowedByDefaultMap](#additionalpropertiesareallowedbydefaultmap) | of([Map](#additionalpropertiesareallowedbydefaultmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md new file mode 100644 index 00000000000..fdc764ec2a1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesCanExistByItself.md @@ -0,0 +1,159 @@ +# AdditionalpropertiesCanExistByItself +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesCanExistByItself.java +class AdditionalpropertiesCanExistByItself
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1](#additionalpropertiescanexistbyitself1)
schema class | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesCanExistByItself.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesCanExistByItself.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesCanExistByItself1Boxed +sealed interface AdditionalpropertiesCanExistByItself1Boxed
+permits
+[AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesCanExistByItself1BoxedMap +data class AdditionalpropertiesCanExistByItself1BoxedMap
+implements [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItself1BoxedMap([AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesCanExistByItself1 +class AdditionalpropertiesCanExistByItself1
+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.AdditionalpropertiesCanExistByItself; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap validatedPayload = + AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.validate( + new AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | validate(arg: [Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1BoxedMap](#additionalpropertiescanexistbyitself1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiescanexistbyitselfmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesCanExistByItself1Boxed](#additionalpropertiescanexistbyitself1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesCanExistByItselfMapBuilder +class AdditionalpropertiesCanExistByItselfMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesCanExistByItselfMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesCanExistByItselfMapBuilder](#additionalpropertiescanexistbyitselfmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesCanExistByItselfMap +class AdditionalpropertiesCanExistByItselfMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesCanExistByItselfMap](#additionalpropertiescanexistbyitselfmap) | of([Map](#additionalpropertiescanexistbyitselfmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md new file mode 100644 index 00000000000..311d802ebd0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.md @@ -0,0 +1,578 @@ +# AdditionalpropertiesDoesNotLookInApplicators +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesDoesNotLookInApplicators.java +class AdditionalpropertiesDoesNotLookInApplicators
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid](#additionalpropertiesdoesnotlookinapplicators1boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean](#additionalpropertiesdoesnotlookinapplicators1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber](#additionalpropertiesdoesnotlookinapplicators1boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedString](#additionalpropertiesdoesnotlookinapplicators1boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedList](#additionalpropertiesdoesnotlookinapplicators1boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1BoxedMap](#additionalpropertiesdoesnotlookinapplicators1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1](#additionalpropertiesdoesnotlookinapplicators1)
schema class | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesDoesNotLookInApplicators.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Schema0](#schema0)
schema class | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.Foo](#foo)
schema class | +| sealed interface | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesDoesNotLookInApplicators.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesDoesNotLookInApplicators1Boxed +sealed interface AdditionalpropertiesDoesNotLookInApplicators1Boxed
+permits
+[AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid](#additionalpropertiesdoesnotlookinapplicators1boxedvoid), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean](#additionalpropertiesdoesnotlookinapplicators1boxedboolean), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber](#additionalpropertiesdoesnotlookinapplicators1boxednumber), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedString](#additionalpropertiesdoesnotlookinapplicators1boxedstring), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedList](#additionalpropertiesdoesnotlookinapplicators1boxedlist), +[AdditionalpropertiesDoesNotLookInApplicators1BoxedMap](#additionalpropertiesdoesnotlookinapplicators1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid
+implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean
+implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber
+implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedString +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedString
+implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedList +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedList
+implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1BoxedMap +data class AdditionalpropertiesDoesNotLookInApplicators1BoxedMap
+implements [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicators1BoxedMap([AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesDoesNotLookInApplicators1 +class AdditionalpropertiesDoesNotLookInApplicators1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) | validate(arg: [Map<?, ?>](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedString](#additionalpropertiesdoesnotlookinapplicators1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid](#additionalpropertiesdoesnotlookinapplicators1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber](#additionalpropertiesdoesnotlookinapplicators1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean](#additionalpropertiesdoesnotlookinapplicators1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedMap](#additionalpropertiesdoesnotlookinapplicators1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1BoxedList](#additionalpropertiesdoesnotlookinapplicators1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AdditionalpropertiesDoesNotLookInApplicators1Boxed](#additionalpropertiesdoesnotlookinapplicators1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder +class AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesDoesNotLookInApplicatorsMap +class AdditionalpropertiesDoesNotLookInApplicatorsMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesDoesNotLookInApplicatorsMap](#additionalpropertiesdoesnotlookinapplicatorsmap) | of([Map](#additionalpropertiesdoesnotlookinapplicatorsmapbuilder) arg, SchemaConfiguration configuration) | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | foo(value: Map) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Boolean) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: String) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Int) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Float) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Long) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Double) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: List) | +| [Schema0MapBuilder](#schema0mapbuilder) | additionalProperty(key: String, value: Map) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..a8be775050b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,159 @@ +# AdditionalpropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesWithNullValuedInstanceProperties.java +class AdditionalpropertiesWithNullValuedInstanceProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1Boxed](#additionalpropertieswithnullvaluedinstanceproperties1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap](#additionalpropertieswithnullvaluedinstanceproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1](#additionalpropertieswithnullvaluedinstanceproperties1)
schema class | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| static class | [AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesWithNullValuedInstanceProperties1Boxed +sealed interface AdditionalpropertiesWithNullValuedInstanceProperties1Boxed
+permits
+[AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap](#additionalpropertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap +data class AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap
+implements [AdditionalpropertiesWithNullValuedInstanceProperties1Boxed](#additionalpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap([AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesWithNullValuedInstanceProperties1 +class AdditionalpropertiesWithNullValuedInstanceProperties1
+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.AdditionalpropertiesWithNullValuedInstanceProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMap validatedPayload = + AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1.validate( + new AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder() + .additionalProperty("someAdditionalProperty", null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) | validate(arg: [Map<?, ?>](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap](#additionalpropertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithNullValuedInstanceProperties1Boxed](#additionalpropertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder +class AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | + +## AdditionalpropertiesWithNullValuedInstancePropertiesMap +class AdditionalpropertiesWithNullValuedInstancePropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesWithNullValuedInstancePropertiesMap](#additionalpropertieswithnullvaluedinstancepropertiesmap) | of([Map](#additionalpropertieswithnullvaluedinstancepropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithSchema.md new file mode 100644 index 00000000000..9b96b2f032d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AdditionalpropertiesWithSchema.md @@ -0,0 +1,446 @@ +# AdditionalpropertiesWithSchema +org.openapijsonschematools.client.components.schemas.AdditionalpropertiesWithSchema.java +class AdditionalpropertiesWithSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1Boxed](#additionalpropertieswithschema1boxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1BoxedMap](#additionalpropertieswithschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1](#additionalpropertieswithschema1)
schema class | +| static class | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder)
builder for Map payloads | +| static class | [AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap)
output class for Map payloads | +| sealed interface | [AdditionalpropertiesWithSchema.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesWithSchema.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithSchema.Bar](#bar)
schema class | +| sealed interface | [AdditionalpropertiesWithSchema.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [AdditionalpropertiesWithSchema.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [AdditionalpropertiesWithSchema.Foo](#foo)
schema class | +| sealed interface | [AdditionalpropertiesWithSchema.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [AdditionalpropertiesWithSchema.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| static class | [AdditionalpropertiesWithSchema.AdditionalProperties](#additionalproperties)
schema class | + +## AdditionalpropertiesWithSchema1Boxed +sealed interface AdditionalpropertiesWithSchema1Boxed
+permits
+[AdditionalpropertiesWithSchema1BoxedMap](#additionalpropertieswithschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalpropertiesWithSchema1BoxedMap +data class AdditionalpropertiesWithSchema1BoxedMap
+implements [AdditionalpropertiesWithSchema1Boxed](#additionalpropertieswithschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithSchema1BoxedMap([AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalpropertiesWithSchema1 +class AdditionalpropertiesWithSchema1
+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.AdditionalpropertiesWithSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMap validatedPayload = + AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.validate( + new AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchemaMapBuilder() + .additionalProperty("someAdditionalProperty", true) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) | validate(arg: [Map<?, ?>](#additionalpropertieswithschemamapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithSchema1BoxedMap](#additionalpropertieswithschema1boxedmap) | validateAndBox([Map<?, ?>](#additionalpropertieswithschemamapbuilder), configuration: SchemaConfiguration) | +| [AdditionalpropertiesWithSchema1Boxed](#additionalpropertieswithschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalpropertiesWithSchemaMapBuilder +class AdditionalpropertiesWithSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalpropertiesWithSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Nothing?) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Boolean) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: String) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Int) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Float) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Long) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Double) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: List) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | foo(value: Map) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Nothing?) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Boolean) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: String) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Int) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Float) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Long) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Double) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: List) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | bar(value: Map) | +| [AdditionalpropertiesWithSchemaMapBuilder](#additionalpropertieswithschemamapbuilder) | additionalProperty(key: String, value: Boolean) | + +## AdditionalpropertiesWithSchemaMap +class AdditionalpropertiesWithSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AdditionalpropertiesWithSchemaMap](#additionalpropertieswithschemamap) | of([Map](#additionalpropertieswithschemamapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | bar()
[optional] | +| Boolean | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Allof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Allof.md new file mode 100644 index 00000000000..5a211961ac4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Allof.md @@ -0,0 +1,674 @@ +# Allof +org.openapijsonschematools.client.components.schemas.Allof.java +class Allof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [Allof.Allof1Boxed](#allof1boxed)
sealed interface for validated payloads | +| record | [Allof.Allof1BoxedVoid](#allof1boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Allof1BoxedBoolean](#allof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Allof1BoxedNumber](#allof1boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Allof1BoxedString](#allof1boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Allof1BoxedList](#allof1boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Allof1BoxedMap](#allof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Allof1](#allof1)
schema class | +| sealed interface | [Allof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Allof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Schema1](#schema1)
schema class | +| static class | [Allof.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [Allof.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [Allof.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [Allof.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [Allof.Foo](#foo)
schema class | +| sealed interface | [Allof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Allof.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [Allof.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [Allof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [Allof.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [Allof.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [Allof.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [Allof.Schema0](#schema0)
schema class | +| static class | [Allof.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [Allof.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [Allof.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [Allof.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [Allof.Bar](#bar)
schema class | + +## Allof1Boxed +sealed interface Allof1Boxed
+permits
+[Allof1BoxedVoid](#allof1boxedvoid), +[Allof1BoxedBoolean](#allof1boxedboolean), +[Allof1BoxedNumber](#allof1boxednumber), +[Allof1BoxedString](#allof1boxedstring), +[Allof1BoxedList](#allof1boxedlist), +[Allof1BoxedMap](#allof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Allof1BoxedVoid +data class Allof1BoxedVoid
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedBoolean +data class Allof1BoxedBoolean
+implements [Allof1Boxed](#allof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedNumber +data class Allof1BoxedNumber
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedString +data class Allof1BoxedString
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedList +data class Allof1BoxedList
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1BoxedMap +data class Allof1BoxedMap
+implements [Allof1Boxed](#allof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Allof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Allof1 +class Allof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Allof1BoxedString](#allof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Allof1BoxedVoid](#allof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Allof1BoxedNumber](#allof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Allof1BoxedBoolean](#allof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Allof1BoxedMap](#allof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Allof1BoxedList](#allof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Allof1Boxed](#allof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md new file mode 100644 index 00000000000..be071761cb0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofCombinedWithAnyofOneof.md @@ -0,0 +1,636 @@ +# AllofCombinedWithAnyofOneof +org.openapijsonschematools.client.components.schemas.AllofCombinedWithAnyofOneof.java +class AllofCombinedWithAnyofOneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1](#allofcombinedwithanyofoneof1)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema0](#schema0)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedBoolean](#schema01boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedNumber](#schema01boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedString](#schema01boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedList](#schema01boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema01BoxedMap](#schema01boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema01](#schema01)
schema class | +| sealed interface | [AllofCombinedWithAnyofOneof.Schema02Boxed](#schema02boxed)
sealed interface for validated payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedVoid](#schema02boxedvoid)
boxed class to store validated null payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedBoolean](#schema02boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedNumber](#schema02boxednumber)
boxed class to store validated Number payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedString](#schema02boxedstring)
boxed class to store validated String payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedList](#schema02boxedlist)
boxed class to store validated List payloads | +| record | [AllofCombinedWithAnyofOneof.Schema02BoxedMap](#schema02boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofCombinedWithAnyofOneof.Schema02](#schema02)
schema class | + +## AllofCombinedWithAnyofOneof1Boxed +sealed interface AllofCombinedWithAnyofOneof1Boxed
+permits
+[AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid), +[AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean), +[AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber), +[AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring), +[AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist), +[AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofCombinedWithAnyofOneof1BoxedVoid +data class AllofCombinedWithAnyofOneof1BoxedVoid
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedBoolean +data class AllofCombinedWithAnyofOneof1BoxedBoolean
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedNumber +data class AllofCombinedWithAnyofOneof1BoxedNumber
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedString +data class AllofCombinedWithAnyofOneof1BoxedString
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedList +data class AllofCombinedWithAnyofOneof1BoxedList
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1BoxedMap +data class AllofCombinedWithAnyofOneof1BoxedMap
+implements [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofCombinedWithAnyofOneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofCombinedWithAnyofOneof1 +class AllofCombinedWithAnyofOneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema02::class.java](#schema02)
;)
| +| List> | anyOf = listOf(
    [Schema01::class.java](#schema01)
)
| +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedString](#allofcombinedwithanyofoneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedVoid](#allofcombinedwithanyofoneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedNumber](#allofcombinedwithanyofoneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedBoolean](#allofcombinedwithanyofoneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedMap](#allofcombinedwithanyofoneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1BoxedList](#allofcombinedwithanyofoneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofCombinedWithAnyofOneof1Boxed](#allofcombinedwithanyofoneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid), +[Schema01BoxedBoolean](#schema01boxedboolean), +[Schema01BoxedNumber](#schema01boxednumber), +[Schema01BoxedString](#schema01boxedstring), +[Schema01BoxedList](#schema01boxedlist), +[Schema01BoxedMap](#schema01boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedBoolean +data class Schema01BoxedBoolean
+implements [Schema01Boxed](#schema01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedNumber +data class Schema01BoxedNumber
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedString +data class Schema01BoxedString
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedList +data class Schema01BoxedList
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01BoxedMap +data class Schema01BoxedMap
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema01BoxedString](#schema01boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema01BoxedVoid](#schema01boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema01BoxedNumber](#schema01boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema01BoxedBoolean](#schema01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema01BoxedMap](#schema01boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema01BoxedList](#schema01boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema01Boxed](#schema01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema02Boxed +sealed interface Schema02Boxed
+permits
+[Schema02BoxedVoid](#schema02boxedvoid), +[Schema02BoxedBoolean](#schema02boxedboolean), +[Schema02BoxedNumber](#schema02boxednumber), +[Schema02BoxedString](#schema02boxedstring), +[Schema02BoxedList](#schema02boxedlist), +[Schema02BoxedMap](#schema02boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema02BoxedVoid +data class Schema02BoxedVoid
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedBoolean +data class Schema02BoxedBoolean
+implements [Schema02Boxed](#schema02boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedNumber +data class Schema02BoxedNumber
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedString +data class Schema02BoxedString
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedList +data class Schema02BoxedList
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02BoxedMap +data class Schema02BoxedMap
+implements [Schema02Boxed](#schema02boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema02BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema02 +class Schema02
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema02BoxedString](#schema02boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema02BoxedVoid](#schema02boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema02BoxedNumber](#schema02boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema02BoxedBoolean](#schema02boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema02BoxedMap](#schema02boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema02BoxedList](#schema02boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema02Boxed](#schema02boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md new file mode 100644 index 00000000000..3797e536800 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofSimpleTypes.md @@ -0,0 +1,479 @@ +# AllofSimpleTypes +org.openapijsonschematools.client.components.schemas.AllofSimpleTypes.java +class AllofSimpleTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofSimpleTypes.AllofSimpleTypes1Boxed](#allofsimpletypes1boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.AllofSimpleTypes1](#allofsimpletypes1)
schema class | +| sealed interface | [AllofSimpleTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema1](#schema1)
schema class | +| sealed interface | [AllofSimpleTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofSimpleTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofSimpleTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofSimpleTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofSimpleTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofSimpleTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofSimpleTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofSimpleTypes.Schema0](#schema0)
schema class | + +## AllofSimpleTypes1Boxed +sealed interface AllofSimpleTypes1Boxed
+permits
+[AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid), +[AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean), +[AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber), +[AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring), +[AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist), +[AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofSimpleTypes1BoxedVoid +data class AllofSimpleTypes1BoxedVoid
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedBoolean +data class AllofSimpleTypes1BoxedBoolean
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedNumber +data class AllofSimpleTypes1BoxedNumber
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedString +data class AllofSimpleTypes1BoxedString
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedList +data class AllofSimpleTypes1BoxedList
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1BoxedMap +data class AllofSimpleTypes1BoxedMap
+implements [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofSimpleTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofSimpleTypes1 +class AllofSimpleTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedString](#allofsimpletypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedVoid](#allofsimpletypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedNumber](#allofsimpletypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedBoolean](#allofsimpletypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedMap](#allofsimpletypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1BoxedList](#allofsimpletypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofSimpleTypes1Boxed](#allofsimpletypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 30 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md new file mode 100644 index 00000000000..2f94b4b3b6a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithBaseSchema.md @@ -0,0 +1,770 @@ +# AllofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AllofWithBaseSchema.java +class AllofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AllofWithBaseSchema.AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchema1](#allofwithbaseschema1)
schema class | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMapBuilder](#allofwithbaseschemamapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.AllofWithBaseSchemaMap](#allofwithbaseschemamap)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithBaseSchema.Bar](#bar)
schema class | +| sealed interface | [AllofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema1](#schema1)
schema class | +| static class | [AllofWithBaseSchema.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.BazBoxed](#bazboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.BazBoxedVoid](#bazboxedvoid)
boxed class to store validated null payloads | +| static class | [AllofWithBaseSchema.Baz](#baz)
schema class | +| sealed interface | [AllofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithBaseSchema.Schema0](#schema0)
schema class | +| static class | [AllofWithBaseSchema.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AllofWithBaseSchema.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AllofWithBaseSchema.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AllofWithBaseSchema.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [AllofWithBaseSchema.Foo](#foo)
schema class | + +## AllofWithBaseSchema1Boxed +sealed interface AllofWithBaseSchema1Boxed
+permits
+[AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid), +[AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean), +[AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber), +[AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring), +[AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist), +[AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithBaseSchema1BoxedVoid +data class AllofWithBaseSchema1BoxedVoid
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedBoolean +data class AllofWithBaseSchema1BoxedBoolean
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedNumber +data class AllofWithBaseSchema1BoxedNumber
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedString +data class AllofWithBaseSchema1BoxedString
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedList +data class AllofWithBaseSchema1BoxedList
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1BoxedMap +data class AllofWithBaseSchema1BoxedMap
+implements [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchema1BoxedMap([AllofWithBaseSchemaMap](#allofwithbaseschemamap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithBaseSchema1 +class AllofWithBaseSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | validate(arg: [Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedString](#allofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedVoid](#allofwithbaseschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedNumber](#allofwithbaseschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedBoolean](#allofwithbaseschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedMap](#allofwithbaseschema1boxedmap) | validateAndBox([Map<?, ?>](#allofwithbaseschemamapbuilder), configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1BoxedList](#allofwithbaseschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithBaseSchema1Boxed](#allofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AllofWithBaseSchemaMap0Builder +class AllofWithBaseSchemaMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Nothing?) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Boolean) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: String) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Double) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: List) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | additionalProperty(key: String, value: Map) | + +## AllofWithBaseSchemaMapBuilder +class AllofWithBaseSchemaMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithBaseSchemaMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Int) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Float) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Long) | +| [AllofWithBaseSchemaMap0Builder](#allofwithbaseschemamap0builder) | bar(value: Double) | + +## AllofWithBaseSchemaMap +class AllofWithBaseSchemaMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [AllofWithBaseSchemaMap](#allofwithbaseschemamap) | of([Map](#allofwithbaseschemamapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "baz" to [Baz::class.java](#baz))
)
| +| Set | required = setOf(
    "baz"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | baz(value: Nothing?) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | baz()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BazBoxed +sealed interface BazBoxed
+permits
+[BazBoxedVoid](#bazboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## BazBoxedVoid +data class BazBoxedVoid
+implements [BazBoxed](#bazboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BazBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Baz +class Baz
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | foo(value: String) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md new file mode 100644 index 00000000000..3a4586b5661 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithOneEmptySchema.md @@ -0,0 +1,302 @@ +# AllofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithOneEmptySchema.java +class AllofWithOneEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.AllofWithOneEmptySchema1](#allofwithoneemptyschema1)
schema class | +| sealed interface | [AllofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithOneEmptySchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithOneEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithOneEmptySchema1Boxed +sealed interface AllofWithOneEmptySchema1Boxed
+permits
+[AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid), +[AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean), +[AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber), +[AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring), +[AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist), +[AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithOneEmptySchema1BoxedVoid +data class AllofWithOneEmptySchema1BoxedVoid
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedBoolean +data class AllofWithOneEmptySchema1BoxedBoolean
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedNumber +data class AllofWithOneEmptySchema1BoxedNumber
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedString +data class AllofWithOneEmptySchema1BoxedString
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedList +data class AllofWithOneEmptySchema1BoxedList
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1BoxedMap +data class AllofWithOneEmptySchema1BoxedMap
+implements [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithOneEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithOneEmptySchema1 +class AllofWithOneEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedString](#allofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedVoid](#allofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedNumber](#allofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedBoolean](#allofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedMap](#allofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1BoxedList](#allofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithOneEmptySchema1Boxed](#allofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md new file mode 100644 index 00000000000..9e14a960664 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheFirstEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheFirstEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheFirstEmptySchema.java +class AllofWithTheFirstEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1](#allofwiththefirstemptyschema1)
schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTheFirstEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheFirstEmptySchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheFirstEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithTheFirstEmptySchema1Boxed +sealed interface AllofWithTheFirstEmptySchema1Boxed
+permits
+[AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid), +[AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean), +[AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber), +[AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring), +[AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist), +[AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheFirstEmptySchema1BoxedVoid +data class AllofWithTheFirstEmptySchema1BoxedVoid
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedBoolean +data class AllofWithTheFirstEmptySchema1BoxedBoolean
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedNumber +data class AllofWithTheFirstEmptySchema1BoxedNumber
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedString +data class AllofWithTheFirstEmptySchema1BoxedString
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedList +data class AllofWithTheFirstEmptySchema1BoxedList
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1BoxedMap +data class AllofWithTheFirstEmptySchema1BoxedMap
+implements [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheFirstEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheFirstEmptySchema1 +class AllofWithTheFirstEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedString](#allofwiththefirstemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedVoid](#allofwiththefirstemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedNumber](#allofwiththefirstemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedBoolean](#allofwiththefirstemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedMap](#allofwiththefirstemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1BoxedList](#allofwiththefirstemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheFirstEmptySchema1Boxed](#allofwiththefirstemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedNumber](#schema1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md new file mode 100644 index 00000000000..b67c14c1c5a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTheLastEmptySchema.md @@ -0,0 +1,340 @@ +# AllofWithTheLastEmptySchema +org.openapijsonschematools.client.components.schemas.AllofWithTheLastEmptySchema.java +class AllofWithTheLastEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1](#allofwiththelastemptyschema1)
schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTheLastEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTheLastEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTheLastEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTheLastEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [AllofWithTheLastEmptySchema.Schema0](#schema0)
schema class | + +## AllofWithTheLastEmptySchema1Boxed +sealed interface AllofWithTheLastEmptySchema1Boxed
+permits
+[AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid), +[AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean), +[AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber), +[AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring), +[AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist), +[AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTheLastEmptySchema1BoxedVoid +data class AllofWithTheLastEmptySchema1BoxedVoid
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedBoolean +data class AllofWithTheLastEmptySchema1BoxedBoolean
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedNumber +data class AllofWithTheLastEmptySchema1BoxedNumber
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedString +data class AllofWithTheLastEmptySchema1BoxedString
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedList +data class AllofWithTheLastEmptySchema1BoxedList
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1BoxedMap +data class AllofWithTheLastEmptySchema1BoxedMap
+implements [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTheLastEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTheLastEmptySchema1 +class AllofWithTheLastEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedString](#allofwiththelastemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedVoid](#allofwiththelastemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedNumber](#allofwiththelastemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedBoolean](#allofwiththelastemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedMap](#allofwiththelastemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1BoxedList](#allofwiththelastemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTheLastEmptySchema1Boxed](#allofwiththelastemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md new file mode 100644 index 00000000000..18791b95b8d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AllofWithTwoEmptySchemas.md @@ -0,0 +1,435 @@ +# AllofWithTwoEmptySchemas +org.openapijsonschematools.client.components.schemas.AllofWithTwoEmptySchemas.java +class AllofWithTwoEmptySchemas
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1](#allofwithtwoemptyschemas1)
schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema1](#schema1)
schema class | +| sealed interface | [AllofWithTwoEmptySchemas.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AllofWithTwoEmptySchemas.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AllofWithTwoEmptySchemas.Schema0](#schema0)
schema class | + +## AllofWithTwoEmptySchemas1Boxed +sealed interface AllofWithTwoEmptySchemas1Boxed
+permits
+[AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid), +[AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean), +[AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber), +[AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring), +[AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist), +[AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AllofWithTwoEmptySchemas1BoxedVoid +data class AllofWithTwoEmptySchemas1BoxedVoid
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedBoolean +data class AllofWithTwoEmptySchemas1BoxedBoolean
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedNumber +data class AllofWithTwoEmptySchemas1BoxedNumber
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedString +data class AllofWithTwoEmptySchemas1BoxedString
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedList +data class AllofWithTwoEmptySchemas1BoxedList
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1BoxedMap +data class AllofWithTwoEmptySchemas1BoxedMap
+implements [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AllofWithTwoEmptySchemas1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AllofWithTwoEmptySchemas1 +class AllofWithTwoEmptySchemas1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedString](#allofwithtwoemptyschemas1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedVoid](#allofwithtwoemptyschemas1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedNumber](#allofwithtwoemptyschemas1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedBoolean](#allofwithtwoemptyschemas1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedMap](#allofwithtwoemptyschemas1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1BoxedList](#allofwithtwoemptyschemas1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AllofWithTwoEmptySchemas1Boxed](#allofwithtwoemptyschemas1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Anyof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Anyof.md new file mode 100644 index 00000000000..0b400ccbe95 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Anyof.md @@ -0,0 +1,362 @@ +# Anyof +org.openapijsonschematools.client.components.schemas.Anyof.java +class Anyof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Anyof.Anyof1Boxed](#anyof1boxed)
sealed interface for validated payloads | +| record | [Anyof.Anyof1BoxedVoid](#anyof1boxedvoid)
boxed class to store validated null payloads | +| record | [Anyof.Anyof1BoxedBoolean](#anyof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Anyof.Anyof1BoxedNumber](#anyof1boxednumber)
boxed class to store validated Number payloads | +| record | [Anyof.Anyof1BoxedString](#anyof1boxedstring)
boxed class to store validated String payloads | +| record | [Anyof.Anyof1BoxedList](#anyof1boxedlist)
boxed class to store validated List payloads | +| record | [Anyof.Anyof1BoxedMap](#anyof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Anyof.Anyof1](#anyof1)
schema class | +| sealed interface | [Anyof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Anyof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Anyof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Anyof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Anyof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Anyof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Anyof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Anyof.Schema1](#schema1)
schema class | +| sealed interface | [Anyof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Anyof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [Anyof.Schema0](#schema0)
schema class | + +## Anyof1Boxed +sealed interface Anyof1Boxed
+permits
+[Anyof1BoxedVoid](#anyof1boxedvoid), +[Anyof1BoxedBoolean](#anyof1boxedboolean), +[Anyof1BoxedNumber](#anyof1boxednumber), +[Anyof1BoxedString](#anyof1boxedstring), +[Anyof1BoxedList](#anyof1boxedlist), +[Anyof1BoxedMap](#anyof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Anyof1BoxedVoid +data class Anyof1BoxedVoid
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedBoolean +data class Anyof1BoxedBoolean
+implements [Anyof1Boxed](#anyof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedNumber +data class Anyof1BoxedNumber
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedString +data class Anyof1BoxedString
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedList +data class Anyof1BoxedList
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1BoxedMap +data class Anyof1BoxedMap
+implements [Anyof1Boxed](#anyof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Anyof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Anyof1 +class Anyof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Anyof1BoxedString](#anyof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Anyof1BoxedVoid](#anyof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Anyof1BoxedNumber](#anyof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Anyof1BoxedBoolean](#anyof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Anyof1BoxedMap](#anyof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Anyof1BoxedList](#anyof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Anyof1Boxed](#anyof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md new file mode 100644 index 00000000000..fa38731618a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofComplexTypes.md @@ -0,0 +1,674 @@ +# AnyofComplexTypes +org.openapijsonschematools.client.components.schemas.AnyofComplexTypes.java +class AnyofComplexTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [AnyofComplexTypes.AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.AnyofComplexTypes1](#anyofcomplextypes1)
schema class | +| sealed interface | [AnyofComplexTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema1](#schema1)
schema class | +| static class | [AnyofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [AnyofComplexTypes.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [AnyofComplexTypes.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [AnyofComplexTypes.Foo](#foo)
schema class | +| sealed interface | [AnyofComplexTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofComplexTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AnyofComplexTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AnyofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofComplexTypes.Schema0](#schema0)
schema class | +| static class | [AnyofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [AnyofComplexTypes.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [AnyofComplexTypes.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [AnyofComplexTypes.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [AnyofComplexTypes.Bar](#bar)
schema class | + +## AnyofComplexTypes1Boxed +sealed interface AnyofComplexTypes1Boxed
+permits
+[AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid), +[AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean), +[AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber), +[AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring), +[AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist), +[AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofComplexTypes1BoxedVoid +data class AnyofComplexTypes1BoxedVoid
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedBoolean +data class AnyofComplexTypes1BoxedBoolean
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedNumber +data class AnyofComplexTypes1BoxedNumber
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedString +data class AnyofComplexTypes1BoxedString
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedList +data class AnyofComplexTypes1BoxedList
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1BoxedMap +data class AnyofComplexTypes1BoxedMap
+implements [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofComplexTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofComplexTypes1 +class AnyofComplexTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedString](#anyofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedVoid](#anyofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedNumber](#anyofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedBoolean](#anyofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedMap](#anyofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1BoxedList](#anyofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofComplexTypes1Boxed](#anyofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md new file mode 100644 index 00000000000..d0175fa0d3d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithBaseSchema.md @@ -0,0 +1,394 @@ +# AnyofWithBaseSchema +org.openapijsonschematools.client.components.schemas.AnyofWithBaseSchema.java +class AnyofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithBaseSchema.AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| static class | [AnyofWithBaseSchema.AnyofWithBaseSchema1](#anyofwithbaseschema1)
schema class | +| sealed interface | [AnyofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema1](#schema1)
schema class | +| sealed interface | [AnyofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithBaseSchema.Schema0](#schema0)
schema class | + +## AnyofWithBaseSchema1Boxed +sealed interface AnyofWithBaseSchema1Boxed
+permits
+[AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithBaseSchema1BoxedString +data class AnyofWithBaseSchema1BoxedString
+implements [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithBaseSchema1 +class AnyofWithBaseSchema1
+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.AnyofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = AnyofWithBaseSchema.AnyofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1BoxedString](#anyofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithBaseSchema1Boxed](#anyofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md new file mode 100644 index 00000000000..9dacfd34348 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/AnyofWithOneEmptySchema.md @@ -0,0 +1,340 @@ +# AnyofWithOneEmptySchema +org.openapijsonschematools.client.components.schemas.AnyofWithOneEmptySchema.java +class AnyofWithOneEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1](#anyofwithoneemptyschema1)
schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [AnyofWithOneEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [AnyofWithOneEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [AnyofWithOneEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [AnyofWithOneEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [AnyofWithOneEmptySchema.Schema0](#schema0)
schema class | + +## AnyofWithOneEmptySchema1Boxed +sealed interface AnyofWithOneEmptySchema1Boxed
+permits
+[AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid), +[AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean), +[AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber), +[AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring), +[AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist), +[AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AnyofWithOneEmptySchema1BoxedVoid +data class AnyofWithOneEmptySchema1BoxedVoid
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedBoolean +data class AnyofWithOneEmptySchema1BoxedBoolean
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedNumber +data class AnyofWithOneEmptySchema1BoxedNumber
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedString +data class AnyofWithOneEmptySchema1BoxedString
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedList +data class AnyofWithOneEmptySchema1BoxedList
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1BoxedMap +data class AnyofWithOneEmptySchema1BoxedMap
+implements [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AnyofWithOneEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AnyofWithOneEmptySchema1 +class AnyofWithOneEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedString](#anyofwithoneemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedVoid](#anyofwithoneemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedNumber](#anyofwithoneemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedBoolean](#anyofwithoneemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedMap](#anyofwithoneemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1BoxedList](#anyofwithoneemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AnyofWithOneEmptySchema1Boxed](#anyofwithoneemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md new file mode 100644 index 00000000000..f96565a4be4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ArrayTypeMatchesArrays.md @@ -0,0 +1,52 @@ +# ArrayTypeMatchesArrays +org.openapijsonschematools.client.components.schemas.ArrayTypeMatchesArrays.java +class ArrayTypeMatchesArrays
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed)
sealed interface for validated payloads | +| record | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist)
boxed class to store validated List payloads | +| static class | [ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1](#arraytypematchesarrays1)
schema class | + +## ArrayTypeMatchesArrays1Boxed +sealed interface ArrayTypeMatchesArrays1Boxed
+permits
+[ArrayTypeMatchesArrays1BoxedList](#arraytypematchesarrays1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ArrayTypeMatchesArrays1BoxedList +data class ArrayTypeMatchesArrays1BoxedList
+implements [ArrayTypeMatchesArrays1Boxed](#arraytypematchesarrays1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ArrayTypeMatchesArrays1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ArrayTypeMatchesArrays1 +class ArrayTypeMatchesArrays1
+extends ListJsonSchema.ListJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.ListJsonSchema.ListJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md new file mode 100644 index 00000000000..e64f7f92c4a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BooleanTypeMatchesBooleans.md @@ -0,0 +1,52 @@ +# BooleanTypeMatchesBooleans +org.openapijsonschematools.client.components.schemas.BooleanTypeMatchesBooleans.java +class BooleanTypeMatchesBooleans
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed)
sealed interface for validated payloads | +| record | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1](#booleantypematchesbooleans1)
schema class | + +## BooleanTypeMatchesBooleans1Boxed +sealed interface BooleanTypeMatchesBooleans1Boxed
+permits
+[BooleanTypeMatchesBooleans1BoxedBoolean](#booleantypematchesbooleans1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## BooleanTypeMatchesBooleans1BoxedBoolean +data class BooleanTypeMatchesBooleans1BoxedBoolean
+implements [BooleanTypeMatchesBooleans1Boxed](#booleantypematchesbooleans1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BooleanTypeMatchesBooleans1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BooleanTypeMatchesBooleans1 +class BooleanTypeMatchesBooleans1
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByInt.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByInt.md new file mode 100644 index 00000000000..1d2e173784f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByInt.md @@ -0,0 +1,169 @@ +# ByInt +org.openapijsonschematools.client.components.schemas.ByInt.java +class ByInt
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByInt.ByInt1Boxed](#byint1boxed)
sealed interface for validated payloads | +| record | [ByInt.ByInt1BoxedVoid](#byint1boxedvoid)
boxed class to store validated null payloads | +| record | [ByInt.ByInt1BoxedBoolean](#byint1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ByInt.ByInt1BoxedNumber](#byint1boxednumber)
boxed class to store validated Number payloads | +| record | [ByInt.ByInt1BoxedString](#byint1boxedstring)
boxed class to store validated String payloads | +| record | [ByInt.ByInt1BoxedList](#byint1boxedlist)
boxed class to store validated List payloads | +| record | [ByInt.ByInt1BoxedMap](#byint1boxedmap)
boxed class to store validated Map payloads | +| static class | [ByInt.ByInt1](#byint1)
schema class | + +## ByInt1Boxed +sealed interface ByInt1Boxed
+permits
+[ByInt1BoxedVoid](#byint1boxedvoid), +[ByInt1BoxedBoolean](#byint1boxedboolean), +[ByInt1BoxedNumber](#byint1boxednumber), +[ByInt1BoxedString](#byint1boxedstring), +[ByInt1BoxedList](#byint1boxedlist), +[ByInt1BoxedMap](#byint1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByInt1BoxedVoid +data class ByInt1BoxedVoid
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedBoolean +data class ByInt1BoxedBoolean
+implements [ByInt1Boxed](#byint1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedNumber +data class ByInt1BoxedNumber
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedString +data class ByInt1BoxedString
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedList +data class ByInt1BoxedList
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1BoxedMap +data class ByInt1BoxedMap
+implements [ByInt1Boxed](#byint1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByInt1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ByInt1 +class ByInt1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByInt1BoxedString](#byint1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByInt1BoxedVoid](#byint1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByInt1BoxedNumber](#byint1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByInt1BoxedBoolean](#byint1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByInt1BoxedMap](#byint1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByInt1BoxedList](#byint1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByInt1Boxed](#byint1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByNumber.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByNumber.md new file mode 100644 index 00000000000..0ef752b157e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ByNumber.md @@ -0,0 +1,169 @@ +# ByNumber +org.openapijsonschematools.client.components.schemas.ByNumber.java +class ByNumber
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ByNumber.ByNumber1Boxed](#bynumber1boxed)
sealed interface for validated payloads | +| record | [ByNumber.ByNumber1BoxedVoid](#bynumber1boxedvoid)
boxed class to store validated null payloads | +| record | [ByNumber.ByNumber1BoxedBoolean](#bynumber1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ByNumber.ByNumber1BoxedNumber](#bynumber1boxednumber)
boxed class to store validated Number payloads | +| record | [ByNumber.ByNumber1BoxedString](#bynumber1boxedstring)
boxed class to store validated String payloads | +| record | [ByNumber.ByNumber1BoxedList](#bynumber1boxedlist)
boxed class to store validated List payloads | +| record | [ByNumber.ByNumber1BoxedMap](#bynumber1boxedmap)
boxed class to store validated Map payloads | +| static class | [ByNumber.ByNumber1](#bynumber1)
schema class | + +## ByNumber1Boxed +sealed interface ByNumber1Boxed
+permits
+[ByNumber1BoxedVoid](#bynumber1boxedvoid), +[ByNumber1BoxedBoolean](#bynumber1boxedboolean), +[ByNumber1BoxedNumber](#bynumber1boxednumber), +[ByNumber1BoxedString](#bynumber1boxedstring), +[ByNumber1BoxedList](#bynumber1boxedlist), +[ByNumber1BoxedMap](#bynumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ByNumber1BoxedVoid +data class ByNumber1BoxedVoid
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedBoolean +data class ByNumber1BoxedBoolean
+implements [ByNumber1Boxed](#bynumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedNumber +data class ByNumber1BoxedNumber
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedString +data class ByNumber1BoxedString
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedList +data class ByNumber1BoxedList
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1BoxedMap +data class ByNumber1BoxedMap
+implements [ByNumber1Boxed](#bynumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ByNumber1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ByNumber1 +class ByNumber1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("1.5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedString](#bynumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ByNumber1BoxedVoid](#bynumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ByNumber1BoxedNumber](#bynumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ByNumber1BoxedBoolean](#bynumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ByNumber1BoxedMap](#bynumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ByNumber1BoxedList](#bynumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ByNumber1Boxed](#bynumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BySmallNumber.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BySmallNumber.md new file mode 100644 index 00000000000..efb24198916 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/BySmallNumber.md @@ -0,0 +1,169 @@ +# BySmallNumber +org.openapijsonschematools.client.components.schemas.BySmallNumber.java +class BySmallNumber
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [BySmallNumber.BySmallNumber1Boxed](#bysmallnumber1boxed)
sealed interface for validated payloads | +| record | [BySmallNumber.BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid)
boxed class to store validated null payloads | +| record | [BySmallNumber.BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean)
boxed class to store validated boolean payloads | +| record | [BySmallNumber.BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber)
boxed class to store validated Number payloads | +| record | [BySmallNumber.BySmallNumber1BoxedString](#bysmallnumber1boxedstring)
boxed class to store validated String payloads | +| record | [BySmallNumber.BySmallNumber1BoxedList](#bysmallnumber1boxedlist)
boxed class to store validated List payloads | +| record | [BySmallNumber.BySmallNumber1BoxedMap](#bysmallnumber1boxedmap)
boxed class to store validated Map payloads | +| static class | [BySmallNumber.BySmallNumber1](#bysmallnumber1)
schema class | + +## BySmallNumber1Boxed +sealed interface BySmallNumber1Boxed
+permits
+[BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid), +[BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean), +[BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber), +[BySmallNumber1BoxedString](#bysmallnumber1boxedstring), +[BySmallNumber1BoxedList](#bysmallnumber1boxedlist), +[BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BySmallNumber1BoxedVoid +data class BySmallNumber1BoxedVoid
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedBoolean +data class BySmallNumber1BoxedBoolean
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedNumber +data class BySmallNumber1BoxedNumber
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedString +data class BySmallNumber1BoxedString
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedList +data class BySmallNumber1BoxedList
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1BoxedMap +data class BySmallNumber1BoxedMap
+implements [BySmallNumber1Boxed](#bysmallnumber1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BySmallNumber1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## BySmallNumber1 +class BySmallNumber1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("0.00010") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedString](#bysmallnumber1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedVoid](#bysmallnumber1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedNumber](#bysmallnumber1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedBoolean](#bysmallnumber1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedMap](#bysmallnumber1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [BySmallNumber1BoxedList](#bysmallnumber1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [BySmallNumber1Boxed](#bysmallnumber1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ConstNulCharactersInStrings.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ConstNulCharactersInStrings.md new file mode 100644 index 00000000000..2164a4dddf4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ConstNulCharactersInStrings.md @@ -0,0 +1,182 @@ +# ConstNulCharactersInStrings +org.openapijsonschematools.client.components.schemas.ConstNulCharactersInStrings.java +class ConstNulCharactersInStrings
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed)
sealed interface for validated payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedVoid](#constnulcharactersinstrings1boxedvoid)
boxed class to store validated null payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedBoolean](#constnulcharactersinstrings1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedNumber](#constnulcharactersinstrings1boxednumber)
boxed class to store validated Number payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedString](#constnulcharactersinstrings1boxedstring)
boxed class to store validated String payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedList](#constnulcharactersinstrings1boxedlist)
boxed class to store validated List payloads | +| record | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1BoxedMap](#constnulcharactersinstrings1boxedmap)
boxed class to store validated Map payloads | +| static class | [ConstNulCharactersInStrings.ConstNulCharactersInStrings1](#constnulcharactersinstrings1)
schema class | +| enum | [ConstNulCharactersInStrings.StringConstNulCharactersInStringsConst](#stringconstnulcharactersinstringsconst)
String enum | + +## ConstNulCharactersInStrings1Boxed +sealed interface ConstNulCharactersInStrings1Boxed
+permits
+[ConstNulCharactersInStrings1BoxedVoid](#constnulcharactersinstrings1boxedvoid), +[ConstNulCharactersInStrings1BoxedBoolean](#constnulcharactersinstrings1boxedboolean), +[ConstNulCharactersInStrings1BoxedNumber](#constnulcharactersinstrings1boxednumber), +[ConstNulCharactersInStrings1BoxedString](#constnulcharactersinstrings1boxedstring), +[ConstNulCharactersInStrings1BoxedList](#constnulcharactersinstrings1boxedlist), +[ConstNulCharactersInStrings1BoxedMap](#constnulcharactersinstrings1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ConstNulCharactersInStrings1BoxedVoid +data class ConstNulCharactersInStrings1BoxedVoid
+implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ConstNulCharactersInStrings1BoxedBoolean +data class ConstNulCharactersInStrings1BoxedBoolean
+implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ConstNulCharactersInStrings1BoxedNumber +data class ConstNulCharactersInStrings1BoxedNumber
+implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ConstNulCharactersInStrings1BoxedString +data class ConstNulCharactersInStrings1BoxedString
+implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ConstNulCharactersInStrings1BoxedList +data class ConstNulCharactersInStrings1BoxedList
+implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ConstNulCharactersInStrings1BoxedMap +data class ConstNulCharactersInStrings1BoxedMap
+implements [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstNulCharactersInStrings1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ConstNulCharactersInStrings1 +class ConstNulCharactersInStrings1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "hello\u0000there" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedString](#constnulcharactersinstrings1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedVoid](#constnulcharactersinstrings1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedNumber](#constnulcharactersinstrings1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedBoolean](#constnulcharactersinstrings1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedMap](#constnulcharactersinstrings1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1BoxedList](#constnulcharactersinstrings1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ConstNulCharactersInStrings1Boxed](#constnulcharactersinstrings1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringConstNulCharactersInStringsConst +public enum StringConstNulCharactersInStringsConst
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| HELLO_NULL_THERE | value = "hello\u0000there" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsKeywordValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsKeywordValidation.md new file mode 100644 index 00000000000..b7ad2bc525d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsKeywordValidation.md @@ -0,0 +1,324 @@ +# ContainsKeywordValidation +org.openapijsonschematools.client.components.schemas.ContainsKeywordValidation.java +class ContainsKeywordValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ContainsKeywordValidation.ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed)
sealed interface for validated payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedVoid](#containskeywordvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedBoolean](#containskeywordvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedNumber](#containskeywordvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedString](#containskeywordvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedList](#containskeywordvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [ContainsKeywordValidation.ContainsKeywordValidation1BoxedMap](#containskeywordvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [ContainsKeywordValidation.ContainsKeywordValidation1](#containskeywordvalidation1)
schema class | +| sealed interface | [ContainsKeywordValidation.ContainsBoxed](#containsboxed)
sealed interface for validated payloads | +| record | [ContainsKeywordValidation.ContainsBoxedVoid](#containsboxedvoid)
boxed class to store validated null payloads | +| record | [ContainsKeywordValidation.ContainsBoxedBoolean](#containsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ContainsKeywordValidation.ContainsBoxedNumber](#containsboxednumber)
boxed class to store validated Number payloads | +| record | [ContainsKeywordValidation.ContainsBoxedString](#containsboxedstring)
boxed class to store validated String payloads | +| record | [ContainsKeywordValidation.ContainsBoxedList](#containsboxedlist)
boxed class to store validated List payloads | +| record | [ContainsKeywordValidation.ContainsBoxedMap](#containsboxedmap)
boxed class to store validated Map payloads | +| static class | [ContainsKeywordValidation.Contains](#contains)
schema class | + +## ContainsKeywordValidation1Boxed +sealed interface ContainsKeywordValidation1Boxed
+permits
+[ContainsKeywordValidation1BoxedVoid](#containskeywordvalidation1boxedvoid), +[ContainsKeywordValidation1BoxedBoolean](#containskeywordvalidation1boxedboolean), +[ContainsKeywordValidation1BoxedNumber](#containskeywordvalidation1boxednumber), +[ContainsKeywordValidation1BoxedString](#containskeywordvalidation1boxedstring), +[ContainsKeywordValidation1BoxedList](#containskeywordvalidation1boxedlist), +[ContainsKeywordValidation1BoxedMap](#containskeywordvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsKeywordValidation1BoxedVoid +data class ContainsKeywordValidation1BoxedVoid
+implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsKeywordValidation1BoxedBoolean +data class ContainsKeywordValidation1BoxedBoolean
+implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsKeywordValidation1BoxedNumber +data class ContainsKeywordValidation1BoxedNumber
+implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsKeywordValidation1BoxedString +data class ContainsKeywordValidation1BoxedString
+implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsKeywordValidation1BoxedList +data class ContainsKeywordValidation1BoxedList
+implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsKeywordValidation1BoxedMap +data class ContainsKeywordValidation1BoxedMap
+implements [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsKeywordValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsKeywordValidation1 +class ContainsKeywordValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedString](#containskeywordvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedVoid](#containskeywordvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedNumber](#containskeywordvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedBoolean](#containskeywordvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedMap](#containskeywordvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1BoxedList](#containskeywordvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsKeywordValidation1Boxed](#containskeywordvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
+permits
+[ContainsBoxedVoid](#containsboxedvoid), +[ContainsBoxedBoolean](#containsboxedboolean), +[ContainsBoxedNumber](#containsboxednumber), +[ContainsBoxedString](#containsboxedstring), +[ContainsBoxedList](#containsboxedlist), +[ContainsBoxedMap](#containsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedBoolean +data class ContainsBoxedBoolean
+implements [ContainsBoxed](#containsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedNumber +data class ContainsBoxedNumber
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedString +data class ContainsBoxedString
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedList +data class ContainsBoxedList
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedMap +data class ContainsBoxedMap
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains +class Contains
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 5 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxedString](#containsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsBoxedVoid](#containsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsBoxedNumber](#containsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsBoxedBoolean](#containsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsBoxedMap](#containsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsBoxedList](#containsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxed](#containsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsWithNullInstanceElements.md new file mode 100644 index 00000000000..62745960f5e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ContainsWithNullInstanceElements.md @@ -0,0 +1,207 @@ +# ContainsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.ContainsWithNullInstanceElements.java +class ContainsWithNullInstanceElements
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed)
sealed interface for validated payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedVoid](#containswithnullinstanceelements1boxedvoid)
boxed class to store validated null payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedBoolean](#containswithnullinstanceelements1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedNumber](#containswithnullinstanceelements1boxednumber)
boxed class to store validated Number payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedString](#containswithnullinstanceelements1boxedstring)
boxed class to store validated String payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedList](#containswithnullinstanceelements1boxedlist)
boxed class to store validated List payloads | +| record | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1BoxedMap](#containswithnullinstanceelements1boxedmap)
boxed class to store validated Map payloads | +| static class | [ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1](#containswithnullinstanceelements1)
schema class | +| sealed interface | [ContainsWithNullInstanceElements.ContainsBoxed](#containsboxed)
sealed interface for validated payloads | +| record | [ContainsWithNullInstanceElements.ContainsBoxedVoid](#containsboxedvoid)
boxed class to store validated null payloads | +| static class | [ContainsWithNullInstanceElements.Contains](#contains)
schema class | + +## ContainsWithNullInstanceElements1Boxed +sealed interface ContainsWithNullInstanceElements1Boxed
+permits
+[ContainsWithNullInstanceElements1BoxedVoid](#containswithnullinstanceelements1boxedvoid), +[ContainsWithNullInstanceElements1BoxedBoolean](#containswithnullinstanceelements1boxedboolean), +[ContainsWithNullInstanceElements1BoxedNumber](#containswithnullinstanceelements1boxednumber), +[ContainsWithNullInstanceElements1BoxedString](#containswithnullinstanceelements1boxedstring), +[ContainsWithNullInstanceElements1BoxedList](#containswithnullinstanceelements1boxedlist), +[ContainsWithNullInstanceElements1BoxedMap](#containswithnullinstanceelements1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsWithNullInstanceElements1BoxedVoid +data class ContainsWithNullInstanceElements1BoxedVoid
+implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsWithNullInstanceElements1BoxedBoolean +data class ContainsWithNullInstanceElements1BoxedBoolean
+implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsWithNullInstanceElements1BoxedNumber +data class ContainsWithNullInstanceElements1BoxedNumber
+implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsWithNullInstanceElements1BoxedString +data class ContainsWithNullInstanceElements1BoxedString
+implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsWithNullInstanceElements1BoxedList +data class ContainsWithNullInstanceElements1BoxedList
+implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsWithNullInstanceElements1BoxedMap +data class ContainsWithNullInstanceElements1BoxedMap
+implements [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsWithNullInstanceElements1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsWithNullInstanceElements1 +class ContainsWithNullInstanceElements1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedString](#containswithnullinstanceelements1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedVoid](#containswithnullinstanceelements1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedNumber](#containswithnullinstanceelements1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedBoolean](#containswithnullinstanceelements1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedMap](#containswithnullinstanceelements1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1BoxedList](#containswithnullinstanceelements1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsWithNullInstanceElements1Boxed](#containswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
+permits
+[ContainsBoxedVoid](#containsboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains +class Contains
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateFormat.md new file mode 100644 index 00000000000..79655ce8dbd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateFormat.md @@ -0,0 +1,169 @@ +# DateFormat +org.openapijsonschematools.client.components.schemas.DateFormat.java +class DateFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateFormat.DateFormat1Boxed](#dateformat1boxed)
sealed interface for validated payloads | +| record | [DateFormat.DateFormat1BoxedVoid](#dateformat1boxedvoid)
boxed class to store validated null payloads | +| record | [DateFormat.DateFormat1BoxedBoolean](#dateformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DateFormat.DateFormat1BoxedNumber](#dateformat1boxednumber)
boxed class to store validated Number payloads | +| record | [DateFormat.DateFormat1BoxedString](#dateformat1boxedstring)
boxed class to store validated String payloads | +| record | [DateFormat.DateFormat1BoxedList](#dateformat1boxedlist)
boxed class to store validated List payloads | +| record | [DateFormat.DateFormat1BoxedMap](#dateformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [DateFormat.DateFormat1](#dateformat1)
schema class | + +## DateFormat1Boxed +sealed interface DateFormat1Boxed
+permits
+[DateFormat1BoxedVoid](#dateformat1boxedvoid), +[DateFormat1BoxedBoolean](#dateformat1boxedboolean), +[DateFormat1BoxedNumber](#dateformat1boxednumber), +[DateFormat1BoxedString](#dateformat1boxedstring), +[DateFormat1BoxedList](#dateformat1boxedlist), +[DateFormat1BoxedMap](#dateformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DateFormat1BoxedVoid +data class DateFormat1BoxedVoid
+implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DateFormat1BoxedBoolean +data class DateFormat1BoxedBoolean
+implements [DateFormat1Boxed](#dateformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DateFormat1BoxedNumber +data class DateFormat1BoxedNumber
+implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DateFormat1BoxedString +data class DateFormat1BoxedString
+implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DateFormat1BoxedList +data class DateFormat1BoxedList
+implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DateFormat1BoxedMap +data class DateFormat1BoxedMap
+implements [DateFormat1Boxed](#dateformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## DateFormat1 +class DateFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DateFormat1BoxedString](#dateformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DateFormat1BoxedVoid](#dateformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DateFormat1BoxedNumber](#dateformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DateFormat1BoxedBoolean](#dateformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DateFormat1BoxedMap](#dateformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DateFormat1BoxedList](#dateformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DateFormat1Boxed](#dateformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md new file mode 100644 index 00000000000..1844f22cea8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DateTimeFormat.md @@ -0,0 +1,169 @@ +# DateTimeFormat +org.openapijsonschematools.client.components.schemas.DateTimeFormat.java +class DateTimeFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DateTimeFormat.DateTimeFormat1Boxed](#datetimeformat1boxed)
sealed interface for validated payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid)
boxed class to store validated null payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber)
boxed class to store validated Number payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedString](#datetimeformat1boxedstring)
boxed class to store validated String payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedList](#datetimeformat1boxedlist)
boxed class to store validated List payloads | +| record | [DateTimeFormat.DateTimeFormat1BoxedMap](#datetimeformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [DateTimeFormat.DateTimeFormat1](#datetimeformat1)
schema class | + +## DateTimeFormat1Boxed +sealed interface DateTimeFormat1Boxed
+permits
+[DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid), +[DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean), +[DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber), +[DateTimeFormat1BoxedString](#datetimeformat1boxedstring), +[DateTimeFormat1BoxedList](#datetimeformat1boxedlist), +[DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DateTimeFormat1BoxedVoid +data class DateTimeFormat1BoxedVoid
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedBoolean +data class DateTimeFormat1BoxedBoolean
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedNumber +data class DateTimeFormat1BoxedNumber
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedString +data class DateTimeFormat1BoxedString
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedList +data class DateTimeFormat1BoxedList
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1BoxedMap +data class DateTimeFormat1BoxedMap
+implements [DateTimeFormat1Boxed](#datetimeformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DateTimeFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## DateTimeFormat1 +class DateTimeFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "date-time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedString](#datetimeformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedVoid](#datetimeformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedNumber](#datetimeformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedBoolean](#datetimeformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedMap](#datetimeformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DateTimeFormat1BoxedList](#datetimeformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DateTimeFormat1Boxed](#datetimeformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md new file mode 100644 index 00000000000..1a95be1b214 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.md @@ -0,0 +1,545 @@ +# DependentSchemasDependenciesWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.DependentSchemasDependenciesWithEscapedCharacters.java +class DependentSchemasDependenciesWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid](#dependentschemasdependencieswithescapedcharacters1boxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean](#dependentschemasdependencieswithescapedcharacters1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber](#dependentschemasdependencieswithescapedcharacters1boxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedString](#dependentschemasdependencieswithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedList](#dependentschemasdependencieswithescapedcharacters1boxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1BoxedMap](#dependentschemasdependencieswithescapedcharacters1boxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1](#dependentschemasdependencieswithescapedcharacters1)
schema class | +| sealed interface | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxed](#foobarboxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedVoid](#foobarboxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedBoolean](#foobarboxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedNumber](#foobarboxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedString](#foobarboxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedList](#foobarboxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FoobarBoxedMap](#foobarboxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.Foobar](#foobar)
schema class | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.FoobarMapBuilder](#foobarmapbuilder)
builder for Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.FoobarMap](#foobarmap)
output class for Map payloads | +| sealed interface | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxed](#footbarboxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedVoid](#footbarboxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedBoolean](#footbarboxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedNumber](#footbarboxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedString](#footbarboxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedList](#footbarboxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasDependenciesWithEscapedCharacters.FootbarBoxedMap](#footbarboxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependenciesWithEscapedCharacters.Footbar](#footbar)
schema class | + +## DependentSchemasDependenciesWithEscapedCharacters1Boxed +sealed interface DependentSchemasDependenciesWithEscapedCharacters1Boxed
+permits
+[DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid](#dependentschemasdependencieswithescapedcharacters1boxedvoid), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean](#dependentschemasdependencieswithescapedcharacters1boxedboolean), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber](#dependentschemasdependencieswithescapedcharacters1boxednumber), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedString](#dependentschemasdependencieswithescapedcharacters1boxedstring), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedList](#dependentschemasdependencieswithescapedcharacters1boxedlist), +[DependentSchemasDependenciesWithEscapedCharacters1BoxedMap](#dependentschemasdependencieswithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid
+implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean
+implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber
+implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedString +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedString
+implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedList +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedList
+implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1BoxedMap +data class DependentSchemasDependenciesWithEscapedCharacters1BoxedMap
+implements [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependenciesWithEscapedCharacters1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependenciesWithEscapedCharacters1 +class DependentSchemasDependenciesWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentSchemas = mapOf(
    "foo\tbar" to [Footbar::class.java](#footbar)),
    "foo'bar" to [Foobar::class.java](#foobar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedString](#dependentschemasdependencieswithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid](#dependentschemasdependencieswithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber](#dependentschemasdependencieswithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean](#dependentschemasdependencieswithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedMap](#dependentschemasdependencieswithescapedcharacters1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1BoxedList](#dependentschemasdependencieswithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependenciesWithEscapedCharacters1Boxed](#dependentschemasdependencieswithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoobarBoxed +sealed interface FoobarBoxed
+permits
+[FoobarBoxedVoid](#foobarboxedvoid), +[FoobarBoxedBoolean](#foobarboxedboolean), +[FoobarBoxedNumber](#foobarboxednumber), +[FoobarBoxedString](#foobarboxedstring), +[FoobarBoxedList](#foobarboxedlist), +[FoobarBoxedMap](#foobarboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FoobarBoxedVoid +data class FoobarBoxedVoid
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FoobarBoxedBoolean +data class FoobarBoxedBoolean
+implements [FoobarBoxed](#foobarboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FoobarBoxedNumber +data class FoobarBoxedNumber
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FoobarBoxedString +data class FoobarBoxedString
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FoobarBoxedList +data class FoobarBoxedList
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FoobarBoxedMap +data class FoobarBoxedMap
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedMap([FoobarMap](#foobarmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FoobarMap](#foobarmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## Foobar +class Foobar
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "foo\"bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [FoobarMap](#foobarmap) | validate(arg: [Map<?, ?>](#foobarmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FoobarBoxedString](#foobarboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FoobarBoxedVoid](#foobarboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FoobarBoxedNumber](#foobarboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FoobarBoxedBoolean](#foobarboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FoobarBoxedMap](#foobarboxedmap) | validateAndBox([Map<?, ?>](#foobarmapbuilder), configuration: SchemaConfiguration) | +| [FoobarBoxedList](#foobarboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FoobarBoxed](#foobarboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoobarMap0Builder +class FoobarMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Boolean) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: String) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Int) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Float) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Long) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Double) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: List) | +| [FoobarMap0Builder](#foobarmap0builder) | additionalProperty(key: String, value: Map) | + +## FoobarMapBuilder +class FoobarMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [FoobarMap0Builder](#foobarmap0builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## FoobarMap +class FoobarMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FoobarMap](#foobarmap) | of([Map](#foobarmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["foo\"bar"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FootbarBoxed +sealed interface FootbarBoxed
+permits
+[FootbarBoxedVoid](#footbarboxedvoid), +[FootbarBoxedBoolean](#footbarboxedboolean), +[FootbarBoxedNumber](#footbarboxednumber), +[FootbarBoxedString](#footbarboxedstring), +[FootbarBoxedList](#footbarboxedlist), +[FootbarBoxedMap](#footbarboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FootbarBoxedVoid +data class FootbarBoxedVoid
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FootbarBoxedBoolean +data class FootbarBoxedBoolean
+implements [FootbarBoxed](#footbarboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FootbarBoxedNumber +data class FootbarBoxedNumber
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FootbarBoxedString +data class FootbarBoxedString
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FootbarBoxedList +data class FootbarBoxedList
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FootbarBoxedMap +data class FootbarBoxedMap
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Footbar +class Footbar
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minProperties = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FootbarBoxedString](#footbarboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FootbarBoxedVoid](#footbarboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FootbarBoxedNumber](#footbarboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FootbarBoxedBoolean](#footbarboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FootbarBoxedMap](#footbarboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [FootbarBoxedList](#footbarboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FootbarBoxed](#footbarboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md new file mode 100644 index 00000000000..55306653ed8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.md @@ -0,0 +1,732 @@ +# DependentSchemasDependentSubschemaIncompatibleWithRoot +org.openapijsonschematools.client.components.schemas.DependentSchemasDependentSubschemaIncompatibleWithRoot.java +class DependentSchemasDependentSubschemaIncompatibleWithRoot
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid](#dependentschemasdependentsubschemaincompatiblewithroot1boxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean](#dependentschemasdependentsubschemaincompatiblewithroot1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber](#dependentschemasdependentsubschemaincompatiblewithroot1boxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString](#dependentschemasdependentsubschemaincompatiblewithroot1boxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList](#dependentschemasdependentsubschemaincompatiblewithroot1boxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap](#dependentschemasdependentsubschemaincompatiblewithroot1boxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1](#dependentschemasdependentsubschemaincompatiblewithroot1)
schema class | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder)
builder for Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap)
output class for Map payloads | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo](#foo)
schema class | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1Boxed](#foo1boxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1BoxedMap](#foo1boxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1](#foo1)
schema class | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMapBuilder1](#foomapbuilder1)
builder for Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMap](#foomap)
output class for Map payloads | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.Bar](#bar)
schema class | +| sealed interface | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasDependentSubschemaIncompatibleWithRoot.AdditionalProperties](#additionalproperties)
schema class | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed +sealed interface DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed
+permits
+[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid](#dependentschemasdependentsubschemaincompatiblewithroot1boxedvoid), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean](#dependentschemasdependentsubschemaincompatiblewithroot1boxedboolean), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber](#dependentschemasdependentsubschemaincompatiblewithroot1boxednumber), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString](#dependentschemasdependentsubschemaincompatiblewithroot1boxedstring), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList](#dependentschemasdependentsubschemaincompatiblewithroot1boxedlist), +[DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap](#dependentschemasdependentsubschemaincompatiblewithroot1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid
+implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean
+implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber
+implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString
+implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList
+implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap +data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap
+implements [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap([DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasDependentSubschemaIncompatibleWithRoot1 +class DependentSchemasDependentSubschemaIncompatibleWithRoot1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Map> | dependentSchemas = mapOf(
    "foo" to [Foo1::class.java](#foo1))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) | validate(arg: [Map<?, ?>](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString](#dependentschemasdependentsubschemaincompatiblewithroot1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid](#dependentschemasdependentsubschemaincompatiblewithroot1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber](#dependentschemasdependentsubschemaincompatiblewithroot1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean](#dependentschemasdependentsubschemaincompatiblewithroot1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap](#dependentschemasdependentsubschemaincompatiblewithroot1boxedmap) | validateAndBox([Map<?, ?>](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder), configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList](#dependentschemasdependentsubschemaincompatiblewithroot1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed](#dependentschemasdependentsubschemaincompatiblewithroot1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder +class DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Nothing?) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Boolean) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: String) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Int) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Float) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Long) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Double) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: List) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | foo(value: Map) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: String) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Int) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Float) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Long) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Double) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: List) | +| [DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) | additionalProperty(key: String, value: Map) | + +## DependentSchemasDependentSubschemaIncompatibleWithRootMap +class DependentSchemasDependentSubschemaIncompatibleWithRootMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [DependentSchemasDependentSubschemaIncompatibleWithRootMap](#dependentschemasdependentsubschemaincompatiblewithrootmap) | of([Map](#dependentschemasdependentsubschemaincompatiblewithrootmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Foo1Boxed +sealed interface Foo1Boxed
+permits
+[Foo1BoxedMap](#foo1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Foo1BoxedMap +data class Foo1BoxedMap
+implements [Foo1Boxed](#foo1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foo1BoxedMap([FooMap](#foomap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooMap](#foomap) | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo1 +class Foo1
+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.DependentSchemasDependentSubschemaIncompatibleWithRoot; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMap validatedPayload = + DependentSchemasDependentSubschemaIncompatibleWithRoot.Foo1.validate( + new DependentSchemasDependentSubschemaIncompatibleWithRoot.FooMapBuilder1() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [FooMap](#foomap) | validate(arg: [Map<?, ?>](#foomapbuilder1), configuration: SchemaConfiguration) | +| [Foo1BoxedMap](#foo1boxedmap) | validateAndBox([Map<?, ?>](#foomapbuilder1), configuration: SchemaConfiguration) | +| [Foo1Boxed](#foo1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FooMapBuilder1 +class FooMapBuilder1
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooMapBuilder1()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Nothing?) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Boolean) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: String) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Int) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Float) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Long) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Double) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: List) | +| [FooMapBuilder1](#foomapbuilder1) | bar(value: Map) | + +## FooMap +class FooMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [FooMap](#foomap) | of([Map](#foomapbuilder1) arg, SchemaConfiguration configuration) | +| Any? | bar()
[optional] | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid), +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean), +[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber), +[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring), +[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist), +[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedString +data class AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedList +data class AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedMap +data class AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md new file mode 100644 index 00000000000..f62f019fbb4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DependentSchemasSingleDependency.md @@ -0,0 +1,451 @@ +# DependentSchemasSingleDependency +org.openapijsonschematools.client.components.schemas.DependentSchemasSingleDependency.java +class DependentSchemasSingleDependency
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed)
sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedVoid](#dependentschemassingledependency1boxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedBoolean](#dependentschemassingledependency1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedNumber](#dependentschemassingledependency1boxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedString](#dependentschemassingledependency1boxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedList](#dependentschemassingledependency1boxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1BoxedMap](#dependentschemassingledependency1boxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasSingleDependency.DependentSchemasSingleDependency1](#dependentschemassingledependency1)
schema class | +| sealed interface | [DependentSchemasSingleDependency.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [DependentSchemasSingleDependency.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [DependentSchemasSingleDependency.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [DependentSchemasSingleDependency.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [DependentSchemasSingleDependency.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [DependentSchemasSingleDependency.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [DependentSchemasSingleDependency.Bar](#bar)
schema class | +| static class | [DependentSchemasSingleDependency.BarMapBuilder1](#barmapbuilder1)
builder for Map payloads | +| static class | [DependentSchemasSingleDependency.BarMap](#barmap)
output class for Map payloads | +| sealed interface | [DependentSchemasSingleDependency.Bar1Boxed](#bar1boxed)
sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.Bar1BoxedNumber](#bar1boxednumber)
boxed class to store validated Number payloads | +| static class | [DependentSchemasSingleDependency.Bar1](#bar1)
schema class | +| sealed interface | [DependentSchemasSingleDependency.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [DependentSchemasSingleDependency.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| static class | [DependentSchemasSingleDependency.Foo](#foo)
schema class | + +## DependentSchemasSingleDependency1Boxed +sealed interface DependentSchemasSingleDependency1Boxed
+permits
+[DependentSchemasSingleDependency1BoxedVoid](#dependentschemassingledependency1boxedvoid), +[DependentSchemasSingleDependency1BoxedBoolean](#dependentschemassingledependency1boxedboolean), +[DependentSchemasSingleDependency1BoxedNumber](#dependentschemassingledependency1boxednumber), +[DependentSchemasSingleDependency1BoxedString](#dependentschemassingledependency1boxedstring), +[DependentSchemasSingleDependency1BoxedList](#dependentschemassingledependency1boxedlist), +[DependentSchemasSingleDependency1BoxedMap](#dependentschemassingledependency1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DependentSchemasSingleDependency1BoxedVoid +data class DependentSchemasSingleDependency1BoxedVoid
+implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasSingleDependency1BoxedBoolean +data class DependentSchemasSingleDependency1BoxedBoolean
+implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasSingleDependency1BoxedNumber +data class DependentSchemasSingleDependency1BoxedNumber
+implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasSingleDependency1BoxedString +data class DependentSchemasSingleDependency1BoxedString
+implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasSingleDependency1BoxedList +data class DependentSchemasSingleDependency1BoxedList
+implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasSingleDependency1BoxedMap +data class DependentSchemasSingleDependency1BoxedMap
+implements [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DependentSchemasSingleDependency1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## DependentSchemasSingleDependency1 +class DependentSchemasSingleDependency1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentSchemas = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedString](#dependentschemassingledependency1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedVoid](#dependentschemassingledependency1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedNumber](#dependentschemassingledependency1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedBoolean](#dependentschemassingledependency1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedMap](#dependentschemassingledependency1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1BoxedList](#dependentschemassingledependency1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DependentSchemasSingleDependency1Boxed](#dependentschemassingledependency1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap([BarMap](#barmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [BarMap](#barmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar1::class.java](#bar1))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [BarMap](#barmap) | validate(arg: [Map<?, ?>](#barmapbuilder1), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxedVoid](#barboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [BarBoxedNumber](#barboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [BarBoxedBoolean](#barboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [BarBoxedMap](#barboxedmap) | validateAndBox([Map<?, ?>](#barmapbuilder1), configuration: SchemaConfiguration) | +| [BarBoxedList](#barboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BarMapBuilder1 +class BarMapBuilder1
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarMapBuilder1()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Int) | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Float) | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Long) | +| [BarMapBuilder1](#barmapbuilder1) | foo(value: Double) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Int) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Float) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Long) | +| [BarMapBuilder1](#barmapbuilder1) | bar(value: Double) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Nothing?) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Boolean) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: String) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Int) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Float) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Long) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Double) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: List) | +| [BarMapBuilder1](#barmapbuilder1) | additionalProperty(key: String, value: Map) | + +## BarMap +class BarMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [BarMap](#barmap) | of([Map](#barmapbuilder1) arg, SchemaConfiguration configuration) | +| Number | foo()
[optional] | +| Number | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Bar1Boxed +sealed interface Bar1Boxed
+permits
+[Bar1BoxedNumber](#bar1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Bar1BoxedNumber +data class Bar1BoxedNumber
+implements [Bar1Boxed](#bar1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Bar1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar1 +class Bar1
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedNumber](#fooboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DurationFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DurationFormat.md new file mode 100644 index 00000000000..a0d1e2009ae --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/DurationFormat.md @@ -0,0 +1,169 @@ +# DurationFormat +org.openapijsonschematools.client.components.schemas.DurationFormat.java +class DurationFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [DurationFormat.DurationFormat1Boxed](#durationformat1boxed)
sealed interface for validated payloads | +| record | [DurationFormat.DurationFormat1BoxedVoid](#durationformat1boxedvoid)
boxed class to store validated null payloads | +| record | [DurationFormat.DurationFormat1BoxedBoolean](#durationformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [DurationFormat.DurationFormat1BoxedNumber](#durationformat1boxednumber)
boxed class to store validated Number payloads | +| record | [DurationFormat.DurationFormat1BoxedString](#durationformat1boxedstring)
boxed class to store validated String payloads | +| record | [DurationFormat.DurationFormat1BoxedList](#durationformat1boxedlist)
boxed class to store validated List payloads | +| record | [DurationFormat.DurationFormat1BoxedMap](#durationformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [DurationFormat.DurationFormat1](#durationformat1)
schema class | + +## DurationFormat1Boxed +sealed interface DurationFormat1Boxed
+permits
+[DurationFormat1BoxedVoid](#durationformat1boxedvoid), +[DurationFormat1BoxedBoolean](#durationformat1boxedboolean), +[DurationFormat1BoxedNumber](#durationformat1boxednumber), +[DurationFormat1BoxedString](#durationformat1boxedstring), +[DurationFormat1BoxedList](#durationformat1boxedlist), +[DurationFormat1BoxedMap](#durationformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## DurationFormat1BoxedVoid +data class DurationFormat1BoxedVoid
+implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## DurationFormat1BoxedBoolean +data class DurationFormat1BoxedBoolean
+implements [DurationFormat1Boxed](#durationformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## DurationFormat1BoxedNumber +data class DurationFormat1BoxedNumber
+implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## DurationFormat1BoxedString +data class DurationFormat1BoxedString
+implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## DurationFormat1BoxedList +data class DurationFormat1BoxedList
+implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## DurationFormat1BoxedMap +data class DurationFormat1BoxedMap
+implements [DurationFormat1Boxed](#durationformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| DurationFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## DurationFormat1 +class DurationFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "duration"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedString](#durationformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedVoid](#durationformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedNumber](#durationformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedBoolean](#durationformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedMap](#durationformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [DurationFormat1BoxedList](#durationformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [DurationFormat1Boxed](#durationformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmailFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmailFormat.md new file mode 100644 index 00000000000..53b4cde33e0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmailFormat.md @@ -0,0 +1,169 @@ +# EmailFormat +org.openapijsonschematools.client.components.schemas.EmailFormat.java +class EmailFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EmailFormat.EmailFormat1Boxed](#emailformat1boxed)
sealed interface for validated payloads | +| record | [EmailFormat.EmailFormat1BoxedVoid](#emailformat1boxedvoid)
boxed class to store validated null payloads | +| record | [EmailFormat.EmailFormat1BoxedBoolean](#emailformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [EmailFormat.EmailFormat1BoxedNumber](#emailformat1boxednumber)
boxed class to store validated Number payloads | +| record | [EmailFormat.EmailFormat1BoxedString](#emailformat1boxedstring)
boxed class to store validated String payloads | +| record | [EmailFormat.EmailFormat1BoxedList](#emailformat1boxedlist)
boxed class to store validated List payloads | +| record | [EmailFormat.EmailFormat1BoxedMap](#emailformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [EmailFormat.EmailFormat1](#emailformat1)
schema class | + +## EmailFormat1Boxed +sealed interface EmailFormat1Boxed
+permits
+[EmailFormat1BoxedVoid](#emailformat1boxedvoid), +[EmailFormat1BoxedBoolean](#emailformat1boxedboolean), +[EmailFormat1BoxedNumber](#emailformat1boxednumber), +[EmailFormat1BoxedString](#emailformat1boxedstring), +[EmailFormat1BoxedList](#emailformat1boxedlist), +[EmailFormat1BoxedMap](#emailformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EmailFormat1BoxedVoid +data class EmailFormat1BoxedVoid
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedBoolean +data class EmailFormat1BoxedBoolean
+implements [EmailFormat1Boxed](#emailformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedNumber +data class EmailFormat1BoxedNumber
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedString +data class EmailFormat1BoxedString
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedList +data class EmailFormat1BoxedList
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1BoxedMap +data class EmailFormat1BoxedMap
+implements [EmailFormat1Boxed](#emailformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmailFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## EmailFormat1 +class EmailFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "email"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedString](#emailformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedVoid](#emailformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedNumber](#emailformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedBoolean](#emailformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedMap](#emailformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [EmailFormat1BoxedList](#emailformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [EmailFormat1Boxed](#emailformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md new file mode 100644 index 00000000000..816e3548dfd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EmptyDependents.md @@ -0,0 +1,176 @@ +# EmptyDependents +org.openapijsonschematools.client.components.schemas.EmptyDependents.java +class EmptyDependents
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EmptyDependents.EmptyDependents1Boxed](#emptydependents1boxed)
sealed interface for validated payloads | +| record | [EmptyDependents.EmptyDependents1BoxedVoid](#emptydependents1boxedvoid)
boxed class to store validated null payloads | +| record | [EmptyDependents.EmptyDependents1BoxedBoolean](#emptydependents1boxedboolean)
boxed class to store validated boolean payloads | +| record | [EmptyDependents.EmptyDependents1BoxedNumber](#emptydependents1boxednumber)
boxed class to store validated Number payloads | +| record | [EmptyDependents.EmptyDependents1BoxedString](#emptydependents1boxedstring)
boxed class to store validated String payloads | +| record | [EmptyDependents.EmptyDependents1BoxedList](#emptydependents1boxedlist)
boxed class to store validated List payloads | +| record | [EmptyDependents.EmptyDependents1BoxedMap](#emptydependents1boxedmap)
boxed class to store validated Map payloads | +| static class | [EmptyDependents.EmptyDependents1](#emptydependents1)
schema class | + +## EmptyDependents1Boxed +sealed interface EmptyDependents1Boxed
+permits
+[EmptyDependents1BoxedVoid](#emptydependents1boxedvoid), +[EmptyDependents1BoxedBoolean](#emptydependents1boxedboolean), +[EmptyDependents1BoxedNumber](#emptydependents1boxednumber), +[EmptyDependents1BoxedString](#emptydependents1boxedstring), +[EmptyDependents1BoxedList](#emptydependents1boxedlist), +[EmptyDependents1BoxedMap](#emptydependents1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EmptyDependents1BoxedVoid +data class EmptyDependents1BoxedVoid
+implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## EmptyDependents1BoxedBoolean +data class EmptyDependents1BoxedBoolean
+implements [EmptyDependents1Boxed](#emptydependents1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EmptyDependents1BoxedNumber +data class EmptyDependents1BoxedNumber
+implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EmptyDependents1BoxedString +data class EmptyDependents1BoxedString
+implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## EmptyDependents1BoxedList +data class EmptyDependents1BoxedList
+implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## EmptyDependents1BoxedMap +data class EmptyDependents1BoxedMap
+implements [EmptyDependents1Boxed](#emptydependents1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EmptyDependents1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## EmptyDependents1 +class EmptyDependents1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentRequired = mapOf(
+    Pair(
+        "bar",
+        setOf( +        ) +    )
+) + | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedString](#emptydependents1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedVoid](#emptydependents1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedNumber](#emptydependents1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedBoolean](#emptydependents1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedMap](#emptydependents1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [EmptyDependents1BoxedList](#emptydependents1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [EmptyDependents1Boxed](#emptydependents1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md new file mode 100644 index 00000000000..b33bd6fd650 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith0DoesNotMatchFalse.md @@ -0,0 +1,133 @@ +# EnumWith0DoesNotMatchFalse +org.openapijsonschematools.client.components.schemas.EnumWith0DoesNotMatchFalse.java +class EnumWith0DoesNotMatchFalse
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed)
sealed interface for validated payloads | +| record | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber)
boxed class to store validated Number payloads | +| static class | [EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1](#enumwith0doesnotmatchfalse1)
schema class | +| enum | [EnumWith0DoesNotMatchFalse.IntegerEnumWith0DoesNotMatchFalseEnums](#integerenumwith0doesnotmatchfalseenums)
Integer enum | +| enum | [EnumWith0DoesNotMatchFalse.LongEnumWith0DoesNotMatchFalseEnums](#longenumwith0doesnotmatchfalseenums)
Long enum | +| enum | [EnumWith0DoesNotMatchFalse.FloatEnumWith0DoesNotMatchFalseEnums](#floatenumwith0doesnotmatchfalseenums)
Float enum | +| enum | [EnumWith0DoesNotMatchFalse.DoubleEnumWith0DoesNotMatchFalseEnums](#doubleenumwith0doesnotmatchfalseenums)
Double enum | + +## EnumWith0DoesNotMatchFalse1Boxed +sealed interface EnumWith0DoesNotMatchFalse1Boxed
+permits
+[EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith0DoesNotMatchFalse1BoxedNumber +data class EnumWith0DoesNotMatchFalse1BoxedNumber
+implements [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith0DoesNotMatchFalse1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWith0DoesNotMatchFalse1 +class EnumWith0DoesNotMatchFalse1
+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.EnumWith0DoesNotMatchFalse; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    0
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1BoxedNumber](#enumwith0doesnotmatchfalse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith0DoesNotMatchFalse1Boxed](#enumwith0doesnotmatchfalse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith0DoesNotMatchFalseEnums +public enum IntegerEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0 | + +## LongEnumWith0DoesNotMatchFalseEnums +public enum LongEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0L | + +## FloatEnumWith0DoesNotMatchFalseEnums +public enum FloatEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0f | + +## DoubleEnumWith0DoesNotMatchFalseEnums +public enum DoubleEnumWith0DoesNotMatchFalseEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = 0.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md new file mode 100644 index 00000000000..a296b3a613f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWith1DoesNotMatchTrue.md @@ -0,0 +1,133 @@ +# EnumWith1DoesNotMatchTrue +org.openapijsonschematools.client.components.schemas.EnumWith1DoesNotMatchTrue.java +class EnumWith1DoesNotMatchTrue
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed)
sealed interface for validated payloads | +| record | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber)
boxed class to store validated Number payloads | +| static class | [EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1](#enumwith1doesnotmatchtrue1)
schema class | +| enum | [EnumWith1DoesNotMatchTrue.IntegerEnumWith1DoesNotMatchTrueEnums](#integerenumwith1doesnotmatchtrueenums)
Integer enum | +| enum | [EnumWith1DoesNotMatchTrue.LongEnumWith1DoesNotMatchTrueEnums](#longenumwith1doesnotmatchtrueenums)
Long enum | +| enum | [EnumWith1DoesNotMatchTrue.FloatEnumWith1DoesNotMatchTrueEnums](#floatenumwith1doesnotmatchtrueenums)
Float enum | +| enum | [EnumWith1DoesNotMatchTrue.DoubleEnumWith1DoesNotMatchTrueEnums](#doubleenumwith1doesnotmatchtrueenums)
Double enum | + +## EnumWith1DoesNotMatchTrue1Boxed +sealed interface EnumWith1DoesNotMatchTrue1Boxed
+permits
+[EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## EnumWith1DoesNotMatchTrue1BoxedNumber +data class EnumWith1DoesNotMatchTrue1BoxedNumber
+implements [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWith1DoesNotMatchTrue1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWith1DoesNotMatchTrue1 +class EnumWith1DoesNotMatchTrue1
+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.EnumWith1DoesNotMatchTrue; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    1
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1BoxedNumber](#enumwith1doesnotmatchtrue1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [EnumWith1DoesNotMatchTrue1Boxed](#enumwith1doesnotmatchtrue1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerEnumWith1DoesNotMatchTrueEnums +public enum IntegerEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | + +## LongEnumWith1DoesNotMatchTrueEnums +public enum LongEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | + +## FloatEnumWith1DoesNotMatchTrueEnums +public enum FloatEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | + +## DoubleEnumWith1DoesNotMatchTrueEnums +public enum DoubleEnumWith1DoesNotMatchTrueEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md new file mode 100644 index 00000000000..54458d5522a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithEscapedCharacters.md @@ -0,0 +1,99 @@ +# EnumWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.EnumWithEscapedCharacters.java +class EnumWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| static class | [EnumWithEscapedCharacters.EnumWithEscapedCharacters1](#enumwithescapedcharacters1)
schema class | +| enum | [EnumWithEscapedCharacters.StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums)
String enum | + +## EnumWithEscapedCharacters1Boxed +sealed interface EnumWithEscapedCharacters1Boxed
+permits
+[EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithEscapedCharacters1BoxedString +data class EnumWithEscapedCharacters1BoxedString
+implements [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithEscapedCharacters1 +class EnumWithEscapedCharacters1
+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.EnumWithEscapedCharacters; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.validate( + "foo\nbar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "foo\nbar",
    "foo\rbar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringEnumWithEscapedCharactersEnums](#stringenumwithescapedcharactersenums), configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1BoxedString](#enumwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [EnumWithEscapedCharacters1Boxed](#enumwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringEnumWithEscapedCharactersEnums +public enum StringEnumWithEscapedCharactersEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO_LINE_FEED_LF_BAR | value = "foo\nbar" | +| FOO_CARRIAGE_RETURN_CR_BAR | value = "foo\rbar" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md new file mode 100644 index 00000000000..8055fb6b4d9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithFalseDoesNotMatch0.md @@ -0,0 +1,98 @@ +# EnumWithFalseDoesNotMatch0 +org.openapijsonschematools.client.components.schemas.EnumWithFalseDoesNotMatch0.java +class EnumWithFalseDoesNotMatch0
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed)
sealed interface for validated payloads | +| record | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean)
boxed class to store validated boolean payloads | +| static class | [EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01](#enumwithfalsedoesnotmatch01)
schema class | +| enum | [EnumWithFalseDoesNotMatch0.BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums)
boolean enum | + +## EnumWithFalseDoesNotMatch01Boxed +sealed interface EnumWithFalseDoesNotMatch01Boxed
+permits
+[EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithFalseDoesNotMatch01BoxedBoolean +data class EnumWithFalseDoesNotMatch01BoxedBoolean
+implements [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithFalseDoesNotMatch01BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithFalseDoesNotMatch01 +class EnumWithFalseDoesNotMatch01
+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.EnumWithFalseDoesNotMatch0; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.validate( + false, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
    false
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithFalseDoesNotMatch0Enums](#booleanenumwithfalsedoesnotmatch0enums), configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01BoxedBoolean](#enumwithfalsedoesnotmatch01boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithFalseDoesNotMatch01Boxed](#enumwithfalsedoesnotmatch01boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithFalseDoesNotMatch0Enums +public enum BooleanEnumWithFalseDoesNotMatch0Enums
+extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FALSE | value = false | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md new file mode 100644 index 00000000000..c22cd9303bb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumWithTrueDoesNotMatch1.md @@ -0,0 +1,98 @@ +# EnumWithTrueDoesNotMatch1 +org.openapijsonschematools.client.components.schemas.EnumWithTrueDoesNotMatch1.java +class EnumWithTrueDoesNotMatch1
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed)
sealed interface for validated payloads | +| record | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean)
boxed class to store validated boolean payloads | +| static class | [EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11](#enumwithtruedoesnotmatch11)
schema class | +| enum | [EnumWithTrueDoesNotMatch1.BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums)
boolean enum | + +## EnumWithTrueDoesNotMatch11Boxed +sealed interface EnumWithTrueDoesNotMatch11Boxed
+permits
+[EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## EnumWithTrueDoesNotMatch11BoxedBoolean +data class EnumWithTrueDoesNotMatch11BoxedBoolean
+implements [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumWithTrueDoesNotMatch11BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumWithTrueDoesNotMatch11 +class EnumWithTrueDoesNotMatch11
+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.EnumWithTrueDoesNotMatch1; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// boolean validation +boolean validatedPayload = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Boolean::class.java) | +| Set | enumValues = setOf(
    true
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| boolean | validate(arg: [BooleanEnumWithTrueDoesNotMatch1Enums](#booleanenumwithtruedoesnotmatch1enums), configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11BoxedBoolean](#enumwithtruedoesnotmatch11boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [EnumWithTrueDoesNotMatch11Boxed](#enumwithtruedoesnotmatch11boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BooleanEnumWithTrueDoesNotMatch1Enums +public enum BooleanEnumWithTrueDoesNotMatch1Enums
+extends `Enum` + +A class that stores boolean enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| TRUE | value = true | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md new file mode 100644 index 00000000000..dad4dd136ad --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/EnumsInProperties.md @@ -0,0 +1,320 @@ +# EnumsInProperties +org.openapijsonschematools.client.components.schemas.EnumsInProperties.java +class EnumsInProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [EnumsInProperties.EnumsInProperties1Boxed](#enumsinproperties1boxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [EnumsInProperties.EnumsInProperties1](#enumsinproperties1)
schema class | +| static class | [EnumsInProperties.EnumsInPropertiesMapBuilder](#enumsinpropertiesmapbuilder)
builder for Map payloads | +| static class | [EnumsInProperties.EnumsInPropertiesMap](#enumsinpropertiesmap)
output class for Map payloads | +| sealed interface | [EnumsInProperties.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [EnumsInProperties.Bar](#bar)
schema class | +| enum | [EnumsInProperties.StringBarEnums](#stringbarenums)
String enum | +| sealed interface | [EnumsInProperties.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [EnumsInProperties.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [EnumsInProperties.Foo](#foo)
schema class | +| enum | [EnumsInProperties.StringFooEnums](#stringfooenums)
String enum | + +## EnumsInProperties1Boxed +sealed interface EnumsInProperties1Boxed
+permits
+[EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## EnumsInProperties1BoxedMap +data class EnumsInProperties1BoxedMap
+implements [EnumsInProperties1Boxed](#enumsinproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInProperties1BoxedMap([EnumsInPropertiesMap](#enumsinpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## EnumsInProperties1 +class EnumsInProperties1
+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.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +EnumsInProperties.EnumsInPropertiesMap validatedPayload = + EnumsInProperties.EnumsInProperties1.validate( + new EnumsInProperties.EnumsInPropertiesMapBuilder() + .bar("bar") + + .foo("foo") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap](#enumsinpropertiesmap) | validate(arg: [Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1BoxedMap](#enumsinproperties1boxedmap) | validateAndBox([Map<?, ?>](#enumsinpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [EnumsInProperties1Boxed](#enumsinproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## EnumsInPropertiesMap0Builder +class EnumsInPropertiesMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | foo(value: [StringFooEnums](#stringfooenums)) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Boolean) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Int) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Float) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Long) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Double) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: List) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | additionalProperty(key: String, value: Map) | + +## EnumsInPropertiesMapBuilder +class EnumsInPropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| EnumsInPropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: String) | +| [EnumsInPropertiesMap0Builder](#enumsinpropertiesmap0builder) | bar(value: [StringBarEnums](#stringbarenums)) | + +## EnumsInPropertiesMap +class EnumsInPropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [EnumsInPropertiesMap](#enumsinpropertiesmap) | of([Map](#enumsinpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | bar()
must be one of ["bar"] | +| String | foo()
[optional] must be one of ["foo"] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+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.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Bar.validate( + "bar", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringBarEnums](#stringbarenums), configuration: SchemaConfiguration) | +| [BarBoxedString](#barboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [BarBoxed](#barboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringBarEnums +public enum StringBarEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| BAR | value = "bar" | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+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.EnumsInProperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = EnumsInProperties.Foo.validate( + "foo", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringFooEnums](#stringfooenums), configuration: SchemaConfiguration) | +| [FooBoxedString](#fooboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringFooEnums +public enum StringFooEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| FOO | value = "foo" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusivemaximumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusivemaximumValidation.md new file mode 100644 index 00000000000..abb9d6bfeb0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusivemaximumValidation.md @@ -0,0 +1,169 @@ +# ExclusivemaximumValidation +org.openapijsonschematools.client.components.schemas.ExclusivemaximumValidation.java +class ExclusivemaximumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ExclusivemaximumValidation.ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed)
sealed interface for validated payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedVoid](#exclusivemaximumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedBoolean](#exclusivemaximumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedNumber](#exclusivemaximumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedString](#exclusivemaximumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedList](#exclusivemaximumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [ExclusivemaximumValidation.ExclusivemaximumValidation1BoxedMap](#exclusivemaximumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [ExclusivemaximumValidation.ExclusivemaximumValidation1](#exclusivemaximumvalidation1)
schema class | + +## ExclusivemaximumValidation1Boxed +sealed interface ExclusivemaximumValidation1Boxed
+permits
+[ExclusivemaximumValidation1BoxedVoid](#exclusivemaximumvalidation1boxedvoid), +[ExclusivemaximumValidation1BoxedBoolean](#exclusivemaximumvalidation1boxedboolean), +[ExclusivemaximumValidation1BoxedNumber](#exclusivemaximumvalidation1boxednumber), +[ExclusivemaximumValidation1BoxedString](#exclusivemaximumvalidation1boxedstring), +[ExclusivemaximumValidation1BoxedList](#exclusivemaximumvalidation1boxedlist), +[ExclusivemaximumValidation1BoxedMap](#exclusivemaximumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ExclusivemaximumValidation1BoxedVoid +data class ExclusivemaximumValidation1BoxedVoid
+implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusivemaximumValidation1BoxedBoolean +data class ExclusivemaximumValidation1BoxedBoolean
+implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusivemaximumValidation1BoxedNumber +data class ExclusivemaximumValidation1BoxedNumber
+implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusivemaximumValidation1BoxedString +data class ExclusivemaximumValidation1BoxedString
+implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusivemaximumValidation1BoxedList +data class ExclusivemaximumValidation1BoxedList
+implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusivemaximumValidation1BoxedMap +data class ExclusivemaximumValidation1BoxedMap
+implements [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusivemaximumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusivemaximumValidation1 +class ExclusivemaximumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 3.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedString](#exclusivemaximumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedVoid](#exclusivemaximumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedNumber](#exclusivemaximumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedBoolean](#exclusivemaximumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedMap](#exclusivemaximumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1BoxedList](#exclusivemaximumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ExclusivemaximumValidation1Boxed](#exclusivemaximumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusiveminimumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusiveminimumValidation.md new file mode 100644 index 00000000000..aa688f8c18d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ExclusiveminimumValidation.md @@ -0,0 +1,169 @@ +# ExclusiveminimumValidation +org.openapijsonschematools.client.components.schemas.ExclusiveminimumValidation.java +class ExclusiveminimumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ExclusiveminimumValidation.ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed)
sealed interface for validated payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedVoid](#exclusiveminimumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedBoolean](#exclusiveminimumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedNumber](#exclusiveminimumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedString](#exclusiveminimumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedList](#exclusiveminimumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [ExclusiveminimumValidation.ExclusiveminimumValidation1BoxedMap](#exclusiveminimumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [ExclusiveminimumValidation.ExclusiveminimumValidation1](#exclusiveminimumvalidation1)
schema class | + +## ExclusiveminimumValidation1Boxed +sealed interface ExclusiveminimumValidation1Boxed
+permits
+[ExclusiveminimumValidation1BoxedVoid](#exclusiveminimumvalidation1boxedvoid), +[ExclusiveminimumValidation1BoxedBoolean](#exclusiveminimumvalidation1boxedboolean), +[ExclusiveminimumValidation1BoxedNumber](#exclusiveminimumvalidation1boxednumber), +[ExclusiveminimumValidation1BoxedString](#exclusiveminimumvalidation1boxedstring), +[ExclusiveminimumValidation1BoxedList](#exclusiveminimumvalidation1boxedlist), +[ExclusiveminimumValidation1BoxedMap](#exclusiveminimumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ExclusiveminimumValidation1BoxedVoid +data class ExclusiveminimumValidation1BoxedVoid
+implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusiveminimumValidation1BoxedBoolean +data class ExclusiveminimumValidation1BoxedBoolean
+implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusiveminimumValidation1BoxedNumber +data class ExclusiveminimumValidation1BoxedNumber
+implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusiveminimumValidation1BoxedString +data class ExclusiveminimumValidation1BoxedString
+implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusiveminimumValidation1BoxedList +data class ExclusiveminimumValidation1BoxedList
+implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusiveminimumValidation1BoxedMap +data class ExclusiveminimumValidation1BoxedMap
+implements [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ExclusiveminimumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ExclusiveminimumValidation1 +class ExclusiveminimumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMinimum = 1.1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedString](#exclusiveminimumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedVoid](#exclusiveminimumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedNumber](#exclusiveminimumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedBoolean](#exclusiveminimumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedMap](#exclusiveminimumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1BoxedList](#exclusiveminimumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ExclusiveminimumValidation1Boxed](#exclusiveminimumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/FloatDivisionInf.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/FloatDivisionInf.md new file mode 100644 index 00000000000..e7135dd2f87 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/FloatDivisionInf.md @@ -0,0 +1,85 @@ +# FloatDivisionInf +org.openapijsonschematools.client.components.schemas.FloatDivisionInf.java +class FloatDivisionInf
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [FloatDivisionInf.FloatDivisionInf1Boxed](#floatdivisioninf1boxed)
sealed interface for validated payloads | +| record | [FloatDivisionInf.FloatDivisionInf1BoxedNumber](#floatdivisioninf1boxednumber)
boxed class to store validated Number payloads | +| static class | [FloatDivisionInf.FloatDivisionInf1](#floatdivisioninf1)
schema class | + +## FloatDivisionInf1Boxed +sealed interface FloatDivisionInf1Boxed
+permits
+[FloatDivisionInf1BoxedNumber](#floatdivisioninf1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FloatDivisionInf1BoxedNumber +data class FloatDivisionInf1BoxedNumber
+implements [FloatDivisionInf1Boxed](#floatdivisioninf1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FloatDivisionInf1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FloatDivisionInf1 +class FloatDivisionInf1
+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.FloatDivisionInf; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = FloatDivisionInf.FloatDivisionInf1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| String | type = "int"; | +| BigDecimal | multipleOf = BigDecimal("0.123456789") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [FloatDivisionInf1BoxedNumber](#floatdivisioninf1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FloatDivisionInf1Boxed](#floatdivisioninf1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md new file mode 100644 index 00000000000..e36ce2a34e8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ForbiddenProperty.md @@ -0,0 +1,508 @@ +# ForbiddenProperty +org.openapijsonschematools.client.components.schemas.ForbiddenProperty.java +class ForbiddenProperty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ForbiddenProperty.ForbiddenProperty1Boxed](#forbiddenproperty1boxed)
sealed interface for validated payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid)
boxed class to store validated null payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber)
boxed class to store validated Number payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring)
boxed class to store validated String payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist)
boxed class to store validated List payloads | +| record | [ForbiddenProperty.ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap)
boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.ForbiddenProperty1](#forbiddenproperty1)
schema class | +| static class | [ForbiddenProperty.ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder)
builder for Map payloads | +| static class | [ForbiddenProperty.ForbiddenPropertyMap](#forbiddenpropertymap)
output class for Map payloads | +| sealed interface | [ForbiddenProperty.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [ForbiddenProperty.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [ForbiddenProperty.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [ForbiddenProperty.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [ForbiddenProperty.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [ForbiddenProperty.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.Foo](#foo)
schema class | +| sealed interface | [ForbiddenProperty.NotBoxed](#notboxed)
sealed interface for validated payloads | +| record | [ForbiddenProperty.NotBoxedVoid](#notboxedvoid)
boxed class to store validated null payloads | +| record | [ForbiddenProperty.NotBoxedBoolean](#notboxedboolean)
boxed class to store validated boolean payloads | +| record | [ForbiddenProperty.NotBoxedNumber](#notboxednumber)
boxed class to store validated Number payloads | +| record | [ForbiddenProperty.NotBoxedString](#notboxedstring)
boxed class to store validated String payloads | +| record | [ForbiddenProperty.NotBoxedList](#notboxedlist)
boxed class to store validated List payloads | +| record | [ForbiddenProperty.NotBoxedMap](#notboxedmap)
boxed class to store validated Map payloads | +| static class | [ForbiddenProperty.Not](#not)
schema class | + +## ForbiddenProperty1Boxed +sealed interface ForbiddenProperty1Boxed
+permits
+[ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid), +[ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean), +[ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber), +[ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring), +[ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist), +[ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ForbiddenProperty1BoxedVoid +data class ForbiddenProperty1BoxedVoid
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedBoolean +data class ForbiddenProperty1BoxedBoolean
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedNumber +data class ForbiddenProperty1BoxedNumber
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedString +data class ForbiddenProperty1BoxedString
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedList +data class ForbiddenProperty1BoxedList
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1BoxedMap +data class ForbiddenProperty1BoxedMap
+implements [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenProperty1BoxedMap([ForbiddenPropertyMap](#forbiddenpropertymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## ForbiddenProperty1 +class ForbiddenProperty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ForbiddenPropertyMap](#forbiddenpropertymap) | validate(arg: [Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedString](#forbiddenproperty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedVoid](#forbiddenproperty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedNumber](#forbiddenproperty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedBoolean](#forbiddenproperty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedMap](#forbiddenproperty1boxedmap) | validateAndBox([Map<?, ?>](#forbiddenpropertymapbuilder), configuration: SchemaConfiguration) | +| [ForbiddenProperty1BoxedList](#forbiddenproperty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ForbiddenProperty1Boxed](#forbiddenproperty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ForbiddenPropertyMapBuilder +class ForbiddenPropertyMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ForbiddenPropertyMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | foo(value: Map) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: String) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Int) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Float) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Long) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Double) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: List) | +| [ForbiddenPropertyMapBuilder](#forbiddenpropertymapbuilder) | additionalProperty(key: String, value: Map) | + +## ForbiddenPropertyMap +class ForbiddenPropertyMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ForbiddenPropertyMap](#forbiddenpropertymap) | of([Map](#forbiddenpropertymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FooBoxedString](#fooboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FooBoxedVoid](#fooboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FooBoxedNumber](#fooboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FooBoxedBoolean](#fooboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FooBoxedMap](#fooboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [FooBoxedList](#fooboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
+permits
+[NotBoxedVoid](#notboxedvoid), +[NotBoxedBoolean](#notboxedboolean), +[NotBoxedNumber](#notboxednumber), +[NotBoxedString](#notboxedstring), +[NotBoxedList](#notboxedlist), +[NotBoxedMap](#notboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedVoid +data class NotBoxedVoid
+implements [NotBoxed](#notboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NotBoxedBoolean +data class NotBoxedBoolean
+implements [NotBoxed](#notboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NotBoxedNumber +data class NotBoxedNumber
+implements [NotBoxed](#notboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NotBoxedString +data class NotBoxedString
+implements [NotBoxed](#notboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NotBoxedList +data class NotBoxedList
+implements [NotBoxed](#notboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NotBoxedMap +data class NotBoxedMap
+implements [NotBoxed](#notboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Not +class Not
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/HostnameFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/HostnameFormat.md new file mode 100644 index 00000000000..9bfb2c2b465 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/HostnameFormat.md @@ -0,0 +1,169 @@ +# HostnameFormat +org.openapijsonschematools.client.components.schemas.HostnameFormat.java +class HostnameFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [HostnameFormat.HostnameFormat1Boxed](#hostnameformat1boxed)
sealed interface for validated payloads | +| record | [HostnameFormat.HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid)
boxed class to store validated null payloads | +| record | [HostnameFormat.HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [HostnameFormat.HostnameFormat1BoxedNumber](#hostnameformat1boxednumber)
boxed class to store validated Number payloads | +| record | [HostnameFormat.HostnameFormat1BoxedString](#hostnameformat1boxedstring)
boxed class to store validated String payloads | +| record | [HostnameFormat.HostnameFormat1BoxedList](#hostnameformat1boxedlist)
boxed class to store validated List payloads | +| record | [HostnameFormat.HostnameFormat1BoxedMap](#hostnameformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [HostnameFormat.HostnameFormat1](#hostnameformat1)
schema class | + +## HostnameFormat1Boxed +sealed interface HostnameFormat1Boxed
+permits
+[HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid), +[HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean), +[HostnameFormat1BoxedNumber](#hostnameformat1boxednumber), +[HostnameFormat1BoxedString](#hostnameformat1boxedstring), +[HostnameFormat1BoxedList](#hostnameformat1boxedlist), +[HostnameFormat1BoxedMap](#hostnameformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## HostnameFormat1BoxedVoid +data class HostnameFormat1BoxedVoid
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedBoolean +data class HostnameFormat1BoxedBoolean
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedNumber +data class HostnameFormat1BoxedNumber
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedString +data class HostnameFormat1BoxedString
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedList +data class HostnameFormat1BoxedList
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1BoxedMap +data class HostnameFormat1BoxedMap
+implements [HostnameFormat1Boxed](#hostnameformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| HostnameFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## HostnameFormat1 +class HostnameFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "hostname"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedString](#hostnameformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedVoid](#hostnameformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedNumber](#hostnameformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedBoolean](#hostnameformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedMap](#hostnameformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [HostnameFormat1BoxedList](#hostnameformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [HostnameFormat1Boxed](#hostnameformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnEmailFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnEmailFormat.md new file mode 100644 index 00000000000..697c25e4a13 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnEmailFormat.md @@ -0,0 +1,169 @@ +# IdnEmailFormat +org.openapijsonschematools.client.components.schemas.IdnEmailFormat.java +class IdnEmailFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IdnEmailFormat.IdnEmailFormat1Boxed](#idnemailformat1boxed)
sealed interface for validated payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedVoid](#idnemailformat1boxedvoid)
boxed class to store validated null payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedBoolean](#idnemailformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedNumber](#idnemailformat1boxednumber)
boxed class to store validated Number payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedString](#idnemailformat1boxedstring)
boxed class to store validated String payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedList](#idnemailformat1boxedlist)
boxed class to store validated List payloads | +| record | [IdnEmailFormat.IdnEmailFormat1BoxedMap](#idnemailformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [IdnEmailFormat.IdnEmailFormat1](#idnemailformat1)
schema class | + +## IdnEmailFormat1Boxed +sealed interface IdnEmailFormat1Boxed
+permits
+[IdnEmailFormat1BoxedVoid](#idnemailformat1boxedvoid), +[IdnEmailFormat1BoxedBoolean](#idnemailformat1boxedboolean), +[IdnEmailFormat1BoxedNumber](#idnemailformat1boxednumber), +[IdnEmailFormat1BoxedString](#idnemailformat1boxedstring), +[IdnEmailFormat1BoxedList](#idnemailformat1boxedlist), +[IdnEmailFormat1BoxedMap](#idnemailformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IdnEmailFormat1BoxedVoid +data class IdnEmailFormat1BoxedVoid
+implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnEmailFormat1BoxedBoolean +data class IdnEmailFormat1BoxedBoolean
+implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnEmailFormat1BoxedNumber +data class IdnEmailFormat1BoxedNumber
+implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnEmailFormat1BoxedString +data class IdnEmailFormat1BoxedString
+implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnEmailFormat1BoxedList +data class IdnEmailFormat1BoxedList
+implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnEmailFormat1BoxedMap +data class IdnEmailFormat1BoxedMap
+implements [IdnEmailFormat1Boxed](#idnemailformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnEmailFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnEmailFormat1 +class IdnEmailFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "idn-email"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedString](#idnemailformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedVoid](#idnemailformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedNumber](#idnemailformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedBoolean](#idnemailformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedMap](#idnemailformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IdnEmailFormat1BoxedList](#idnemailformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IdnEmailFormat1Boxed](#idnemailformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnHostnameFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnHostnameFormat.md new file mode 100644 index 00000000000..432027c74d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IdnHostnameFormat.md @@ -0,0 +1,169 @@ +# IdnHostnameFormat +org.openapijsonschematools.client.components.schemas.IdnHostnameFormat.java +class IdnHostnameFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IdnHostnameFormat.IdnHostnameFormat1Boxed](#idnhostnameformat1boxed)
sealed interface for validated payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedVoid](#idnhostnameformat1boxedvoid)
boxed class to store validated null payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedBoolean](#idnhostnameformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedNumber](#idnhostnameformat1boxednumber)
boxed class to store validated Number payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedString](#idnhostnameformat1boxedstring)
boxed class to store validated String payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedList](#idnhostnameformat1boxedlist)
boxed class to store validated List payloads | +| record | [IdnHostnameFormat.IdnHostnameFormat1BoxedMap](#idnhostnameformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [IdnHostnameFormat.IdnHostnameFormat1](#idnhostnameformat1)
schema class | + +## IdnHostnameFormat1Boxed +sealed interface IdnHostnameFormat1Boxed
+permits
+[IdnHostnameFormat1BoxedVoid](#idnhostnameformat1boxedvoid), +[IdnHostnameFormat1BoxedBoolean](#idnhostnameformat1boxedboolean), +[IdnHostnameFormat1BoxedNumber](#idnhostnameformat1boxednumber), +[IdnHostnameFormat1BoxedString](#idnhostnameformat1boxedstring), +[IdnHostnameFormat1BoxedList](#idnhostnameformat1boxedlist), +[IdnHostnameFormat1BoxedMap](#idnhostnameformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IdnHostnameFormat1BoxedVoid +data class IdnHostnameFormat1BoxedVoid
+implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnHostnameFormat1BoxedBoolean +data class IdnHostnameFormat1BoxedBoolean
+implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnHostnameFormat1BoxedNumber +data class IdnHostnameFormat1BoxedNumber
+implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnHostnameFormat1BoxedString +data class IdnHostnameFormat1BoxedString
+implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnHostnameFormat1BoxedList +data class IdnHostnameFormat1BoxedList
+implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnHostnameFormat1BoxedMap +data class IdnHostnameFormat1BoxedMap
+implements [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IdnHostnameFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IdnHostnameFormat1 +class IdnHostnameFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "idn-hostname"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedString](#idnhostnameformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedVoid](#idnhostnameformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedNumber](#idnhostnameformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedBoolean](#idnhostnameformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedMap](#idnhostnameformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1BoxedList](#idnhostnameformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IdnHostnameFormat1Boxed](#idnhostnameformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndElseWithoutThen.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndElseWithoutThen.md new file mode 100644 index 00000000000..6bf87cb8605 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndElseWithoutThen.md @@ -0,0 +1,480 @@ +# IfAndElseWithoutThen +org.openapijsonschematools.client.components.schemas.IfAndElseWithoutThen.java +class IfAndElseWithoutThen
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IfAndElseWithoutThen.IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed)
sealed interface for validated payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedVoid](#ifandelsewithoutthen1boxedvoid)
boxed class to store validated null payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedBoolean](#ifandelsewithoutthen1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedNumber](#ifandelsewithoutthen1boxednumber)
boxed class to store validated Number payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedString](#ifandelsewithoutthen1boxedstring)
boxed class to store validated String payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedList](#ifandelsewithoutthen1boxedlist)
boxed class to store validated List payloads | +| record | [IfAndElseWithoutThen.IfAndElseWithoutThen1BoxedMap](#ifandelsewithoutthen1boxedmap)
boxed class to store validated Map payloads | +| static class | [IfAndElseWithoutThen.IfAndElseWithoutThen1](#ifandelsewithoutthen1)
schema class | +| sealed interface | [IfAndElseWithoutThen.IfSchemaBoxed](#ifschemaboxed)
sealed interface for validated payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedVoid](#ifschemaboxedvoid)
boxed class to store validated null payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedNumber](#ifschemaboxednumber)
boxed class to store validated Number payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedString](#ifschemaboxedstring)
boxed class to store validated String payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedList](#ifschemaboxedlist)
boxed class to store validated List payloads | +| record | [IfAndElseWithoutThen.IfSchemaBoxedMap](#ifschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [IfAndElseWithoutThen.IfSchema](#ifschema)
schema class | +| sealed interface | [IfAndElseWithoutThen.ElseSchemaBoxed](#elseschemaboxed)
sealed interface for validated payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
boxed class to store validated null payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedNumber](#elseschemaboxednumber)
boxed class to store validated Number payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedString](#elseschemaboxedstring)
boxed class to store validated String payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedList](#elseschemaboxedlist)
boxed class to store validated List payloads | +| record | [IfAndElseWithoutThen.ElseSchemaBoxedMap](#elseschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [IfAndElseWithoutThen.ElseSchema](#elseschema)
schema class | + +## IfAndElseWithoutThen1Boxed +sealed interface IfAndElseWithoutThen1Boxed
+permits
+[IfAndElseWithoutThen1BoxedVoid](#ifandelsewithoutthen1boxedvoid), +[IfAndElseWithoutThen1BoxedBoolean](#ifandelsewithoutthen1boxedboolean), +[IfAndElseWithoutThen1BoxedNumber](#ifandelsewithoutthen1boxednumber), +[IfAndElseWithoutThen1BoxedString](#ifandelsewithoutthen1boxedstring), +[IfAndElseWithoutThen1BoxedList](#ifandelsewithoutthen1boxedlist), +[IfAndElseWithoutThen1BoxedMap](#ifandelsewithoutthen1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfAndElseWithoutThen1BoxedVoid +data class IfAndElseWithoutThen1BoxedVoid
+implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndElseWithoutThen1BoxedBoolean +data class IfAndElseWithoutThen1BoxedBoolean
+implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndElseWithoutThen1BoxedNumber +data class IfAndElseWithoutThen1BoxedNumber
+implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndElseWithoutThen1BoxedString +data class IfAndElseWithoutThen1BoxedString
+implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndElseWithoutThen1BoxedList +data class IfAndElseWithoutThen1BoxedList
+implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndElseWithoutThen1BoxedMap +data class IfAndElseWithoutThen1BoxedMap
+implements [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndElseWithoutThen1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndElseWithoutThen1 +class IfAndElseWithoutThen1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedString](#ifandelsewithoutthen1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedVoid](#ifandelsewithoutthen1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedNumber](#ifandelsewithoutthen1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedBoolean](#ifandelsewithoutthen1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedMap](#ifandelsewithoutthen1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1BoxedList](#ifandelsewithoutthen1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfAndElseWithoutThen1Boxed](#ifandelsewithoutthen1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
+permits
+[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
+implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchema +class IfSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
+permits
+[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
+implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchema +class ElseSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndThenWithoutElse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndThenWithoutElse.md new file mode 100644 index 00000000000..f6816588009 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAndThenWithoutElse.md @@ -0,0 +1,480 @@ +# IfAndThenWithoutElse +org.openapijsonschematools.client.components.schemas.IfAndThenWithoutElse.java +class IfAndThenWithoutElse
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IfAndThenWithoutElse.IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed)
sealed interface for validated payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedVoid](#ifandthenwithoutelse1boxedvoid)
boxed class to store validated null payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedBoolean](#ifandthenwithoutelse1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedNumber](#ifandthenwithoutelse1boxednumber)
boxed class to store validated Number payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedString](#ifandthenwithoutelse1boxedstring)
boxed class to store validated String payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedList](#ifandthenwithoutelse1boxedlist)
boxed class to store validated List payloads | +| record | [IfAndThenWithoutElse.IfAndThenWithoutElse1BoxedMap](#ifandthenwithoutelse1boxedmap)
boxed class to store validated Map payloads | +| static class | [IfAndThenWithoutElse.IfAndThenWithoutElse1](#ifandthenwithoutelse1)
schema class | +| sealed interface | [IfAndThenWithoutElse.ThenBoxed](#thenboxed)
sealed interface for validated payloads | +| record | [IfAndThenWithoutElse.ThenBoxedVoid](#thenboxedvoid)
boxed class to store validated null payloads | +| record | [IfAndThenWithoutElse.ThenBoxedBoolean](#thenboxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAndThenWithoutElse.ThenBoxedNumber](#thenboxednumber)
boxed class to store validated Number payloads | +| record | [IfAndThenWithoutElse.ThenBoxedString](#thenboxedstring)
boxed class to store validated String payloads | +| record | [IfAndThenWithoutElse.ThenBoxedList](#thenboxedlist)
boxed class to store validated List payloads | +| record | [IfAndThenWithoutElse.ThenBoxedMap](#thenboxedmap)
boxed class to store validated Map payloads | +| static class | [IfAndThenWithoutElse.Then](#then)
schema class | +| sealed interface | [IfAndThenWithoutElse.IfSchemaBoxed](#ifschemaboxed)
sealed interface for validated payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedVoid](#ifschemaboxedvoid)
boxed class to store validated null payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedNumber](#ifschemaboxednumber)
boxed class to store validated Number payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedString](#ifschemaboxedstring)
boxed class to store validated String payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedList](#ifschemaboxedlist)
boxed class to store validated List payloads | +| record | [IfAndThenWithoutElse.IfSchemaBoxedMap](#ifschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [IfAndThenWithoutElse.IfSchema](#ifschema)
schema class | + +## IfAndThenWithoutElse1Boxed +sealed interface IfAndThenWithoutElse1Boxed
+permits
+[IfAndThenWithoutElse1BoxedVoid](#ifandthenwithoutelse1boxedvoid), +[IfAndThenWithoutElse1BoxedBoolean](#ifandthenwithoutelse1boxedboolean), +[IfAndThenWithoutElse1BoxedNumber](#ifandthenwithoutelse1boxednumber), +[IfAndThenWithoutElse1BoxedString](#ifandthenwithoutelse1boxedstring), +[IfAndThenWithoutElse1BoxedList](#ifandthenwithoutelse1boxedlist), +[IfAndThenWithoutElse1BoxedMap](#ifandthenwithoutelse1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfAndThenWithoutElse1BoxedVoid +data class IfAndThenWithoutElse1BoxedVoid
+implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndThenWithoutElse1BoxedBoolean +data class IfAndThenWithoutElse1BoxedBoolean
+implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndThenWithoutElse1BoxedNumber +data class IfAndThenWithoutElse1BoxedNumber
+implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndThenWithoutElse1BoxedString +data class IfAndThenWithoutElse1BoxedString
+implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndThenWithoutElse1BoxedList +data class IfAndThenWithoutElse1BoxedList
+implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndThenWithoutElse1BoxedMap +data class IfAndThenWithoutElse1BoxedMap
+implements [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAndThenWithoutElse1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAndThenWithoutElse1 +class IfAndThenWithoutElse1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | then = [Then::class.java](#then) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedString](#ifandthenwithoutelse1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedVoid](#ifandthenwithoutelse1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedNumber](#ifandthenwithoutelse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedBoolean](#ifandthenwithoutelse1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedMap](#ifandthenwithoutelse1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1BoxedList](#ifandthenwithoutelse1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfAndThenWithoutElse1Boxed](#ifandthenwithoutelse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
+permits
+[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
+implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
+implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedString +data class ThenBoxedString
+implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedList +data class ThenBoxedList
+implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Then +class Then
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
+permits
+[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
+implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchema +class IfSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md new file mode 100644 index 00000000000..548b66dd824 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.md @@ -0,0 +1,661 @@ +# IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence +org.openapijsonschematools.client.components.schemas.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.java +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed)
sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedvoid)
boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxednumber)
boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedstring)
boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedlist)
boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedmap)
boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1](#ifappearsattheendwhenserializedkeywordprocessingsequence1)
schema class | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxed](#thenboxed)
sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedVoid](#thenboxedvoid)
boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedBoolean](#thenboxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedNumber](#thenboxednumber)
boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedString](#thenboxedstring)
boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedList](#thenboxedlist)
boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ThenBoxedMap](#thenboxedmap)
boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.Then](#then)
schema class | +| enum | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.StringThenConst](#stringthenconst)
String enum | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxed](#ifschemaboxed)
sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedVoid](#ifschemaboxedvoid)
boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedNumber](#ifschemaboxednumber)
boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedString](#ifschemaboxedstring)
boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedList](#ifschemaboxedlist)
boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchemaBoxedMap](#ifschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfSchema](#ifschema)
schema class | +| sealed interface | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxed](#elseschemaboxed)
sealed interface for validated payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
boxed class to store validated null payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedNumber](#elseschemaboxednumber)
boxed class to store validated Number payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedString](#elseschemaboxedstring)
boxed class to store validated String payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedList](#elseschemaboxedlist)
boxed class to store validated List payloads | +| record | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchemaBoxedMap](#elseschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.ElseSchema](#elseschema)
schema class | +| enum | [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.StringElseConst](#stringelseconst)
String enum | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed +sealed interface IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed
+permits
+[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedvoid), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedboolean), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxednumber), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedstring), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedlist), +[IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid
+implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean
+implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber
+implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString
+implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList
+implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap +data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap
+implements [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1 +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | then = [Then::class.java](#then) | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed](#ifappearsattheendwhenserializedkeywordprocessingsequence1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
+permits
+[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
+implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
+implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedString +data class ThenBoxedString
+implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedList +data class ThenBoxedList
+implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Then +class Then
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "yes" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringThenConst +public enum StringThenConst
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| YES | value = "yes" | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
+permits
+[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
+implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchema +class IfSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
+permits
+[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
+implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchema +class ElseSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "other" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringElseConst +public enum StringElseConst
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| OTHER | value = "other" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreElseWithoutIf.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreElseWithoutIf.md new file mode 100644 index 00000000000..c0103ee93df --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreElseWithoutIf.md @@ -0,0 +1,337 @@ +# IgnoreElseWithoutIf +org.openapijsonschematools.client.components.schemas.IgnoreElseWithoutIf.java +class IgnoreElseWithoutIf
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed)
sealed interface for validated payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedVoid](#ignoreelsewithoutif1boxedvoid)
boxed class to store validated null payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedBoolean](#ignoreelsewithoutif1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedNumber](#ignoreelsewithoutif1boxednumber)
boxed class to store validated Number payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedString](#ignoreelsewithoutif1boxedstring)
boxed class to store validated String payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedList](#ignoreelsewithoutif1boxedlist)
boxed class to store validated List payloads | +| record | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1BoxedMap](#ignoreelsewithoutif1boxedmap)
boxed class to store validated Map payloads | +| static class | [IgnoreElseWithoutIf.IgnoreElseWithoutIf1](#ignoreelsewithoutif1)
schema class | +| sealed interface | [IgnoreElseWithoutIf.ElseSchemaBoxed](#elseschemaboxed)
sealed interface for validated payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
boxed class to store validated null payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedNumber](#elseschemaboxednumber)
boxed class to store validated Number payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedString](#elseschemaboxedstring)
boxed class to store validated String payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedList](#elseschemaboxedlist)
boxed class to store validated List payloads | +| record | [IgnoreElseWithoutIf.ElseSchemaBoxedMap](#elseschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [IgnoreElseWithoutIf.ElseSchema](#elseschema)
schema class | +| enum | [IgnoreElseWithoutIf.StringElseConst](#stringelseconst)
String enum | + +## IgnoreElseWithoutIf1Boxed +sealed interface IgnoreElseWithoutIf1Boxed
+permits
+[IgnoreElseWithoutIf1BoxedVoid](#ignoreelsewithoutif1boxedvoid), +[IgnoreElseWithoutIf1BoxedBoolean](#ignoreelsewithoutif1boxedboolean), +[IgnoreElseWithoutIf1BoxedNumber](#ignoreelsewithoutif1boxednumber), +[IgnoreElseWithoutIf1BoxedString](#ignoreelsewithoutif1boxedstring), +[IgnoreElseWithoutIf1BoxedList](#ignoreelsewithoutif1boxedlist), +[IgnoreElseWithoutIf1BoxedMap](#ignoreelsewithoutif1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IgnoreElseWithoutIf1BoxedVoid +data class IgnoreElseWithoutIf1BoxedVoid
+implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreElseWithoutIf1BoxedBoolean +data class IgnoreElseWithoutIf1BoxedBoolean
+implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreElseWithoutIf1BoxedNumber +data class IgnoreElseWithoutIf1BoxedNumber
+implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreElseWithoutIf1BoxedString +data class IgnoreElseWithoutIf1BoxedString
+implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreElseWithoutIf1BoxedList +data class IgnoreElseWithoutIf1BoxedList
+implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreElseWithoutIf1BoxedMap +data class IgnoreElseWithoutIf1BoxedMap
+implements [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreElseWithoutIf1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreElseWithoutIf1 +class IgnoreElseWithoutIf1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedString](#ignoreelsewithoutif1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedVoid](#ignoreelsewithoutif1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedNumber](#ignoreelsewithoutif1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedBoolean](#ignoreelsewithoutif1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedMap](#ignoreelsewithoutif1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1BoxedList](#ignoreelsewithoutif1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IgnoreElseWithoutIf1Boxed](#ignoreelsewithoutif1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
+permits
+[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
+implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchema +class ElseSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "0" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringElseConst +public enum StringElseConst
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = "0" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreIfWithoutThenOrElse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreIfWithoutThenOrElse.md new file mode 100644 index 00000000000..d0c00d7da34 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreIfWithoutThenOrElse.md @@ -0,0 +1,337 @@ +# IgnoreIfWithoutThenOrElse +org.openapijsonschematools.client.components.schemas.IgnoreIfWithoutThenOrElse.java +class IgnoreIfWithoutThenOrElse
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed)
sealed interface for validated payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedVoid](#ignoreifwithoutthenorelse1boxedvoid)
boxed class to store validated null payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedBoolean](#ignoreifwithoutthenorelse1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedNumber](#ignoreifwithoutthenorelse1boxednumber)
boxed class to store validated Number payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedString](#ignoreifwithoutthenorelse1boxedstring)
boxed class to store validated String payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedList](#ignoreifwithoutthenorelse1boxedlist)
boxed class to store validated List payloads | +| record | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1BoxedMap](#ignoreifwithoutthenorelse1boxedmap)
boxed class to store validated Map payloads | +| static class | [IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1](#ignoreifwithoutthenorelse1)
schema class | +| sealed interface | [IgnoreIfWithoutThenOrElse.IfSchemaBoxed](#ifschemaboxed)
sealed interface for validated payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedVoid](#ifschemaboxedvoid)
boxed class to store validated null payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedNumber](#ifschemaboxednumber)
boxed class to store validated Number payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedString](#ifschemaboxedstring)
boxed class to store validated String payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedList](#ifschemaboxedlist)
boxed class to store validated List payloads | +| record | [IgnoreIfWithoutThenOrElse.IfSchemaBoxedMap](#ifschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [IgnoreIfWithoutThenOrElse.IfSchema](#ifschema)
schema class | +| enum | [IgnoreIfWithoutThenOrElse.StringIfConst](#stringifconst)
String enum | + +## IgnoreIfWithoutThenOrElse1Boxed +sealed interface IgnoreIfWithoutThenOrElse1Boxed
+permits
+[IgnoreIfWithoutThenOrElse1BoxedVoid](#ignoreifwithoutthenorelse1boxedvoid), +[IgnoreIfWithoutThenOrElse1BoxedBoolean](#ignoreifwithoutthenorelse1boxedboolean), +[IgnoreIfWithoutThenOrElse1BoxedNumber](#ignoreifwithoutthenorelse1boxednumber), +[IgnoreIfWithoutThenOrElse1BoxedString](#ignoreifwithoutthenorelse1boxedstring), +[IgnoreIfWithoutThenOrElse1BoxedList](#ignoreifwithoutthenorelse1boxedlist), +[IgnoreIfWithoutThenOrElse1BoxedMap](#ignoreifwithoutthenorelse1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IgnoreIfWithoutThenOrElse1BoxedVoid +data class IgnoreIfWithoutThenOrElse1BoxedVoid
+implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedBoolean +data class IgnoreIfWithoutThenOrElse1BoxedBoolean
+implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedNumber +data class IgnoreIfWithoutThenOrElse1BoxedNumber
+implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedString +data class IgnoreIfWithoutThenOrElse1BoxedString
+implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedList +data class IgnoreIfWithoutThenOrElse1BoxedList
+implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreIfWithoutThenOrElse1BoxedMap +data class IgnoreIfWithoutThenOrElse1BoxedMap
+implements [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreIfWithoutThenOrElse1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreIfWithoutThenOrElse1 +class IgnoreIfWithoutThenOrElse1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedString](#ignoreifwithoutthenorelse1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedVoid](#ignoreifwithoutthenorelse1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedNumber](#ignoreifwithoutthenorelse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedBoolean](#ignoreifwithoutthenorelse1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedMap](#ignoreifwithoutthenorelse1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1BoxedList](#ignoreifwithoutthenorelse1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IgnoreIfWithoutThenOrElse1Boxed](#ignoreifwithoutthenorelse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
+permits
+[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
+implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchema +class IfSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "0" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringIfConst +public enum StringIfConst
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = "0" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreThenWithoutIf.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreThenWithoutIf.md new file mode 100644 index 00000000000..fb5782aefc5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IgnoreThenWithoutIf.md @@ -0,0 +1,337 @@ +# IgnoreThenWithoutIf +org.openapijsonschematools.client.components.schemas.IgnoreThenWithoutIf.java +class IgnoreThenWithoutIf
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed)
sealed interface for validated payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedVoid](#ignorethenwithoutif1boxedvoid)
boxed class to store validated null payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedBoolean](#ignorethenwithoutif1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedNumber](#ignorethenwithoutif1boxednumber)
boxed class to store validated Number payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedString](#ignorethenwithoutif1boxedstring)
boxed class to store validated String payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedList](#ignorethenwithoutif1boxedlist)
boxed class to store validated List payloads | +| record | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1BoxedMap](#ignorethenwithoutif1boxedmap)
boxed class to store validated Map payloads | +| static class | [IgnoreThenWithoutIf.IgnoreThenWithoutIf1](#ignorethenwithoutif1)
schema class | +| sealed interface | [IgnoreThenWithoutIf.ThenBoxed](#thenboxed)
sealed interface for validated payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedVoid](#thenboxedvoid)
boxed class to store validated null payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedBoolean](#thenboxedboolean)
boxed class to store validated boolean payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedNumber](#thenboxednumber)
boxed class to store validated Number payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedString](#thenboxedstring)
boxed class to store validated String payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedList](#thenboxedlist)
boxed class to store validated List payloads | +| record | [IgnoreThenWithoutIf.ThenBoxedMap](#thenboxedmap)
boxed class to store validated Map payloads | +| static class | [IgnoreThenWithoutIf.Then](#then)
schema class | +| enum | [IgnoreThenWithoutIf.StringThenConst](#stringthenconst)
String enum | + +## IgnoreThenWithoutIf1Boxed +sealed interface IgnoreThenWithoutIf1Boxed
+permits
+[IgnoreThenWithoutIf1BoxedVoid](#ignorethenwithoutif1boxedvoid), +[IgnoreThenWithoutIf1BoxedBoolean](#ignorethenwithoutif1boxedboolean), +[IgnoreThenWithoutIf1BoxedNumber](#ignorethenwithoutif1boxednumber), +[IgnoreThenWithoutIf1BoxedString](#ignorethenwithoutif1boxedstring), +[IgnoreThenWithoutIf1BoxedList](#ignorethenwithoutif1boxedlist), +[IgnoreThenWithoutIf1BoxedMap](#ignorethenwithoutif1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IgnoreThenWithoutIf1BoxedVoid +data class IgnoreThenWithoutIf1BoxedVoid
+implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreThenWithoutIf1BoxedBoolean +data class IgnoreThenWithoutIf1BoxedBoolean
+implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreThenWithoutIf1BoxedNumber +data class IgnoreThenWithoutIf1BoxedNumber
+implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreThenWithoutIf1BoxedString +data class IgnoreThenWithoutIf1BoxedString
+implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreThenWithoutIf1BoxedList +data class IgnoreThenWithoutIf1BoxedList
+implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreThenWithoutIf1BoxedMap +data class IgnoreThenWithoutIf1BoxedMap
+implements [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IgnoreThenWithoutIf1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IgnoreThenWithoutIf1 +class IgnoreThenWithoutIf1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | then = [Then::class.java](#then) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedString](#ignorethenwithoutif1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedVoid](#ignorethenwithoutif1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedNumber](#ignorethenwithoutif1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedBoolean](#ignorethenwithoutif1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedMap](#ignorethenwithoutif1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1BoxedList](#ignorethenwithoutif1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IgnoreThenWithoutIf1Boxed](#ignorethenwithoutif1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
+permits
+[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
+implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
+implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedString +data class ThenBoxedString
+implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedList +data class ThenBoxedList
+implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Then +class Then
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Any? | constValue = "0" | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringThenConst +public enum StringThenConst
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_0 | value = "0" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md new file mode 100644 index 00000000000..39131a09a05 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IntegerTypeMatchesIntegers.md @@ -0,0 +1,52 @@ +# IntegerTypeMatchesIntegers +org.openapijsonschematools.client.components.schemas.IntegerTypeMatchesIntegers.java +class IntegerTypeMatchesIntegers
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed)
sealed interface for validated payloads | +| record | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber)
boxed class to store validated Number payloads | +| static class | [IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1](#integertypematchesintegers1)
schema class | + +## IntegerTypeMatchesIntegers1Boxed +sealed interface IntegerTypeMatchesIntegers1Boxed
+permits
+[IntegerTypeMatchesIntegers1BoxedNumber](#integertypematchesintegers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## IntegerTypeMatchesIntegers1BoxedNumber +data class IntegerTypeMatchesIntegers1BoxedNumber
+implements [IntegerTypeMatchesIntegers1Boxed](#integertypematchesintegers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IntegerTypeMatchesIntegers1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IntegerTypeMatchesIntegers1 +class IntegerTypeMatchesIntegers1
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv4Format.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv4Format.md new file mode 100644 index 00000000000..0ddec8c4233 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv4Format.md @@ -0,0 +1,169 @@ +# Ipv4Format +org.openapijsonschematools.client.components.schemas.Ipv4Format.java +class Ipv4Format
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv4Format.Ipv4Format1Boxed](#ipv4format1boxed)
sealed interface for validated payloads | +| record | [Ipv4Format.Ipv4Format1BoxedVoid](#ipv4format1boxedvoid)
boxed class to store validated null payloads | +| record | [Ipv4Format.Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Ipv4Format.Ipv4Format1BoxedNumber](#ipv4format1boxednumber)
boxed class to store validated Number payloads | +| record | [Ipv4Format.Ipv4Format1BoxedString](#ipv4format1boxedstring)
boxed class to store validated String payloads | +| record | [Ipv4Format.Ipv4Format1BoxedList](#ipv4format1boxedlist)
boxed class to store validated List payloads | +| record | [Ipv4Format.Ipv4Format1BoxedMap](#ipv4format1boxedmap)
boxed class to store validated Map payloads | +| static class | [Ipv4Format.Ipv4Format1](#ipv4format1)
schema class | + +## Ipv4Format1Boxed +sealed interface Ipv4Format1Boxed
+permits
+[Ipv4Format1BoxedVoid](#ipv4format1boxedvoid), +[Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean), +[Ipv4Format1BoxedNumber](#ipv4format1boxednumber), +[Ipv4Format1BoxedString](#ipv4format1boxedstring), +[Ipv4Format1BoxedList](#ipv4format1boxedlist), +[Ipv4Format1BoxedMap](#ipv4format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv4Format1BoxedVoid +data class Ipv4Format1BoxedVoid
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedBoolean +data class Ipv4Format1BoxedBoolean
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedNumber +data class Ipv4Format1BoxedNumber
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedString +data class Ipv4Format1BoxedString
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedList +data class Ipv4Format1BoxedList
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1BoxedMap +data class Ipv4Format1BoxedMap
+implements [Ipv4Format1Boxed](#ipv4format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv4Format1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv4Format1 +class Ipv4Format1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv4"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedString](#ipv4format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedVoid](#ipv4format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedNumber](#ipv4format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedBoolean](#ipv4format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedMap](#ipv4format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv4Format1BoxedList](#ipv4format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv4Format1Boxed](#ipv4format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv6Format.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv6Format.md new file mode 100644 index 00000000000..d78fd50c8b4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Ipv6Format.md @@ -0,0 +1,169 @@ +# Ipv6Format +org.openapijsonschematools.client.components.schemas.Ipv6Format.java +class Ipv6Format
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Ipv6Format.Ipv6Format1Boxed](#ipv6format1boxed)
sealed interface for validated payloads | +| record | [Ipv6Format.Ipv6Format1BoxedVoid](#ipv6format1boxedvoid)
boxed class to store validated null payloads | +| record | [Ipv6Format.Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Ipv6Format.Ipv6Format1BoxedNumber](#ipv6format1boxednumber)
boxed class to store validated Number payloads | +| record | [Ipv6Format.Ipv6Format1BoxedString](#ipv6format1boxedstring)
boxed class to store validated String payloads | +| record | [Ipv6Format.Ipv6Format1BoxedList](#ipv6format1boxedlist)
boxed class to store validated List payloads | +| record | [Ipv6Format.Ipv6Format1BoxedMap](#ipv6format1boxedmap)
boxed class to store validated Map payloads | +| static class | [Ipv6Format.Ipv6Format1](#ipv6format1)
schema class | + +## Ipv6Format1Boxed +sealed interface Ipv6Format1Boxed
+permits
+[Ipv6Format1BoxedVoid](#ipv6format1boxedvoid), +[Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean), +[Ipv6Format1BoxedNumber](#ipv6format1boxednumber), +[Ipv6Format1BoxedString](#ipv6format1boxedstring), +[Ipv6Format1BoxedList](#ipv6format1boxedlist), +[Ipv6Format1BoxedMap](#ipv6format1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Ipv6Format1BoxedVoid +data class Ipv6Format1BoxedVoid
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedBoolean +data class Ipv6Format1BoxedBoolean
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedNumber +data class Ipv6Format1BoxedNumber
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedString +data class Ipv6Format1BoxedString
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedList +data class Ipv6Format1BoxedList
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1BoxedMap +data class Ipv6Format1BoxedMap
+implements [Ipv6Format1Boxed](#ipv6format1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Ipv6Format1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Ipv6Format1 +class Ipv6Format1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "ipv6"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedString](#ipv6format1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedVoid](#ipv6format1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedNumber](#ipv6format1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedBoolean](#ipv6format1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedMap](#ipv6format1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Ipv6Format1BoxedList](#ipv6format1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Ipv6Format1Boxed](#ipv6format1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriFormat.md new file mode 100644 index 00000000000..a044d8df914 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriFormat.md @@ -0,0 +1,169 @@ +# IriFormat +org.openapijsonschematools.client.components.schemas.IriFormat.java +class IriFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IriFormat.IriFormat1Boxed](#iriformat1boxed)
sealed interface for validated payloads | +| record | [IriFormat.IriFormat1BoxedVoid](#iriformat1boxedvoid)
boxed class to store validated null payloads | +| record | [IriFormat.IriFormat1BoxedBoolean](#iriformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IriFormat.IriFormat1BoxedNumber](#iriformat1boxednumber)
boxed class to store validated Number payloads | +| record | [IriFormat.IriFormat1BoxedString](#iriformat1boxedstring)
boxed class to store validated String payloads | +| record | [IriFormat.IriFormat1BoxedList](#iriformat1boxedlist)
boxed class to store validated List payloads | +| record | [IriFormat.IriFormat1BoxedMap](#iriformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [IriFormat.IriFormat1](#iriformat1)
schema class | + +## IriFormat1Boxed +sealed interface IriFormat1Boxed
+permits
+[IriFormat1BoxedVoid](#iriformat1boxedvoid), +[IriFormat1BoxedBoolean](#iriformat1boxedboolean), +[IriFormat1BoxedNumber](#iriformat1boxednumber), +[IriFormat1BoxedString](#iriformat1boxedstring), +[IriFormat1BoxedList](#iriformat1boxedlist), +[IriFormat1BoxedMap](#iriformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IriFormat1BoxedVoid +data class IriFormat1BoxedVoid
+implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IriFormat1BoxedBoolean +data class IriFormat1BoxedBoolean
+implements [IriFormat1Boxed](#iriformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IriFormat1BoxedNumber +data class IriFormat1BoxedNumber
+implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IriFormat1BoxedString +data class IriFormat1BoxedString
+implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IriFormat1BoxedList +data class IriFormat1BoxedList
+implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IriFormat1BoxedMap +data class IriFormat1BoxedMap
+implements [IriFormat1Boxed](#iriformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IriFormat1 +class IriFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "iri"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IriFormat1BoxedString](#iriformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IriFormat1BoxedVoid](#iriformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IriFormat1BoxedNumber](#iriformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IriFormat1BoxedBoolean](#iriformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IriFormat1BoxedMap](#iriformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IriFormat1BoxedList](#iriformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IriFormat1Boxed](#iriformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriReferenceFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriReferenceFormat.md new file mode 100644 index 00000000000..c5014f940bc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/IriReferenceFormat.md @@ -0,0 +1,169 @@ +# IriReferenceFormat +org.openapijsonschematools.client.components.schemas.IriReferenceFormat.java +class IriReferenceFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [IriReferenceFormat.IriReferenceFormat1Boxed](#irireferenceformat1boxed)
sealed interface for validated payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedVoid](#irireferenceformat1boxedvoid)
boxed class to store validated null payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedBoolean](#irireferenceformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedNumber](#irireferenceformat1boxednumber)
boxed class to store validated Number payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedString](#irireferenceformat1boxedstring)
boxed class to store validated String payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedList](#irireferenceformat1boxedlist)
boxed class to store validated List payloads | +| record | [IriReferenceFormat.IriReferenceFormat1BoxedMap](#irireferenceformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [IriReferenceFormat.IriReferenceFormat1](#irireferenceformat1)
schema class | + +## IriReferenceFormat1Boxed +sealed interface IriReferenceFormat1Boxed
+permits
+[IriReferenceFormat1BoxedVoid](#irireferenceformat1boxedvoid), +[IriReferenceFormat1BoxedBoolean](#irireferenceformat1boxedboolean), +[IriReferenceFormat1BoxedNumber](#irireferenceformat1boxednumber), +[IriReferenceFormat1BoxedString](#irireferenceformat1boxedstring), +[IriReferenceFormat1BoxedList](#irireferenceformat1boxedlist), +[IriReferenceFormat1BoxedMap](#irireferenceformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IriReferenceFormat1BoxedVoid +data class IriReferenceFormat1BoxedVoid
+implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IriReferenceFormat1BoxedBoolean +data class IriReferenceFormat1BoxedBoolean
+implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IriReferenceFormat1BoxedNumber +data class IriReferenceFormat1BoxedNumber
+implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IriReferenceFormat1BoxedString +data class IriReferenceFormat1BoxedString
+implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IriReferenceFormat1BoxedList +data class IriReferenceFormat1BoxedList
+implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IriReferenceFormat1BoxedMap +data class IriReferenceFormat1BoxedMap
+implements [IriReferenceFormat1Boxed](#irireferenceformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IriReferenceFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IriReferenceFormat1 +class IriReferenceFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "iri-reference"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedString](#irireferenceformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedVoid](#irireferenceformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedNumber](#irireferenceformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedBoolean](#irireferenceformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedMap](#irireferenceformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IriReferenceFormat1BoxedList](#irireferenceformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IriReferenceFormat1Boxed](#irireferenceformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsContains.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsContains.md new file mode 100644 index 00000000000..ba6593d7fd7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsContains.md @@ -0,0 +1,438 @@ +# ItemsContains +org.openapijsonschematools.client.components.schemas.ItemsContains.java +class ItemsContains
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ItemsContains.ItemsContains1Boxed](#itemscontains1boxed)
sealed interface for validated payloads | +| record | [ItemsContains.ItemsContains1BoxedList](#itemscontains1boxedlist)
boxed class to store validated List payloads | +| static class | [ItemsContains.ItemsContains1](#itemscontains1)
schema class | +| static class | [ItemsContains.ItemsContainsListBuilder](#itemscontainslistbuilder)
builder for List payloads | +| static class | [ItemsContains.ItemsContainsList](#itemscontainslist)
output class for List payloads | +| sealed interface | [ItemsContains.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ItemsContains.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ItemsContains.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ItemsContains.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ItemsContains.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ItemsContains.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ItemsContains.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ItemsContains.Items](#items)
schema class | +| sealed interface | [ItemsContains.ContainsBoxed](#containsboxed)
sealed interface for validated payloads | +| record | [ItemsContains.ContainsBoxedVoid](#containsboxedvoid)
boxed class to store validated null payloads | +| record | [ItemsContains.ContainsBoxedBoolean](#containsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ItemsContains.ContainsBoxedNumber](#containsboxednumber)
boxed class to store validated Number payloads | +| record | [ItemsContains.ContainsBoxedString](#containsboxedstring)
boxed class to store validated String payloads | +| record | [ItemsContains.ContainsBoxedList](#containsboxedlist)
boxed class to store validated List payloads | +| record | [ItemsContains.ContainsBoxedMap](#containsboxedmap)
boxed class to store validated Map payloads | +| static class | [ItemsContains.Contains](#contains)
schema class | + +## ItemsContains1Boxed +sealed interface ItemsContains1Boxed
+permits
+[ItemsContains1BoxedList](#itemscontains1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsContains1BoxedList +data class ItemsContains1BoxedList
+implements [ItemsContains1Boxed](#itemscontains1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsContains1BoxedList([ItemsContainsList](#itemscontainslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsContainsList](#itemscontainslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsContains1 +class ItemsContains1
+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.ItemsContains; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ItemsContains.ItemsContainsList validatedPayload = + ItemsContains.ItemsContains1.validate( + new ItemsContains.ItemsContainsListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsContainsList](#itemscontainslist) | validate(arg: [List<*>](#itemscontainslistbuilder), configuration: SchemaConfiguration) | +| [ItemsContains1BoxedList](#itemscontains1boxedlist) | validateAndBox([List<*>](#itemscontainslistbuilder), configuration: SchemaConfiguration) | +| [ItemsContains1Boxed](#itemscontains1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsContainsListBuilder +class ItemsContainsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsContainsListBuilder()
Creates an empty list | +| ItemsContainsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsContainsListBuilder | add(item: Nothing?) | +| ItemsContainsListBuilder | add(item: Boolean) | +| ItemsContainsListBuilder | add(item: String) | +| ItemsContainsListBuilder | add(item: Int) | +| ItemsContainsListBuilder | add(item: Float) | +| ItemsContainsListBuilder | add(item: Long) | +| ItemsContainsListBuilder | add(item: Double) | +| ItemsContainsListBuilder | add(item: List) | +| ItemsContainsListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsContainsList +class ItemsContainsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsContainsList](#itemscontainslist) | of([List](#itemscontainslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedBoolean +data class ItemsBoxedBoolean
+implements [ItemsBoxed](#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 | +| Any? | getData()
validated payload | + +## ItemsBoxedNumber +data class ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## ItemsBoxedString +data class ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## ItemsBoxedList +data class ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedMap +data class ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ItemsBoxedVoid](#itemsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ItemsBoxedBoolean](#itemsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ItemsBoxedMap](#itemsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
+permits
+[ContainsBoxedVoid](#containsboxedvoid), +[ContainsBoxedBoolean](#containsboxedboolean), +[ContainsBoxedNumber](#containsboxednumber), +[ContainsBoxedString](#containsboxedstring), +[ContainsBoxedList](#containsboxedlist), +[ContainsBoxedMap](#containsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedBoolean +data class ContainsBoxedBoolean
+implements [ContainsBoxed](#containsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedNumber +data class ContainsBoxedNumber
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedString +data class ContainsBoxedString
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedList +data class ContainsBoxedList
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedMap +data class ContainsBoxedMap
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains +class Contains
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxedString](#containsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsBoxedVoid](#containsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsBoxedNumber](#containsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsBoxedBoolean](#containsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsBoxedMap](#containsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsBoxedList](#containsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxed](#containsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md new file mode 100644 index 00000000000..6a5f4ef5f68 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.md @@ -0,0 +1,282 @@ +# ItemsDoesNotLookInApplicatorsValidCase +org.openapijsonschematools.client.components.schemas.ItemsDoesNotLookInApplicatorsValidCase.java +class ItemsDoesNotLookInApplicatorsValidCase
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1Boxed](#itemsdoesnotlookinapplicatorsvalidcase1boxed)
sealed interface for validated payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1BoxedList](#itemsdoesnotlookinapplicatorsvalidcase1boxedlist)
boxed class to store validated List payloads | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1](#itemsdoesnotlookinapplicatorsvalidcase1)
schema class | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseListBuilder](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder)
builder for List payloads | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist)
output class for List payloads | +| sealed interface | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedBoolean](#itemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedString](#itemsboxedstring)
boxed class to store validated String payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| record | [ItemsDoesNotLookInApplicatorsValidCase.ItemsBoxedMap](#itemsboxedmap)
boxed class to store validated Map payloads | +| static class | [ItemsDoesNotLookInApplicatorsValidCase.Items](#items)
schema class | + +## ItemsDoesNotLookInApplicatorsValidCase1Boxed +sealed interface ItemsDoesNotLookInApplicatorsValidCase1Boxed
+permits
+[ItemsDoesNotLookInApplicatorsValidCase1BoxedList](#itemsdoesnotlookinapplicatorsvalidcase1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsDoesNotLookInApplicatorsValidCase1BoxedList +data class ItemsDoesNotLookInApplicatorsValidCase1BoxedList
+implements [ItemsDoesNotLookInApplicatorsValidCase1Boxed](#itemsdoesnotlookinapplicatorsvalidcase1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsDoesNotLookInApplicatorsValidCase1BoxedList([ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsDoesNotLookInApplicatorsValidCase1 +class ItemsDoesNotLookInApplicatorsValidCase1
+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.ItemsDoesNotLookInApplicatorsValidCase; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseList validatedPayload = + ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1.validate( + new ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseListBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) | validate(arg: [List<*>](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder), configuration: SchemaConfiguration) | +| [ItemsDoesNotLookInApplicatorsValidCase1BoxedList](#itemsdoesnotlookinapplicatorsvalidcase1boxedlist) | validateAndBox([List<*>](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder), configuration: SchemaConfiguration) | +| [ItemsDoesNotLookInApplicatorsValidCase1Boxed](#itemsdoesnotlookinapplicatorsvalidcase1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsDoesNotLookInApplicatorsValidCaseListBuilder +class ItemsDoesNotLookInApplicatorsValidCaseListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder()
Creates an empty list | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Nothing?) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Boolean) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: String) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Int) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Float) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Long) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Double) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: List) | +| ItemsDoesNotLookInApplicatorsValidCaseListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsDoesNotLookInApplicatorsValidCaseList +class ItemsDoesNotLookInApplicatorsValidCaseList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsDoesNotLookInApplicatorsValidCaseList](#itemsdoesnotlookinapplicatorsvalidcaselist) | of([List](#itemsdoesnotlookinapplicatorsvalidcaselistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid), +[ItemsBoxedBoolean](#itemsboxedboolean), +[ItemsBoxedNumber](#itemsboxednumber), +[ItemsBoxedString](#itemsboxedstring), +[ItemsBoxedList](#itemsboxedlist), +[ItemsBoxedMap](#itemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedBoolean +data class ItemsBoxedBoolean
+implements [ItemsBoxed](#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 | +| Any? | getData()
validated payload | + +## ItemsBoxedNumber +data class ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## ItemsBoxedString +data class ItemsBoxedString
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## ItemsBoxedList +data class ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsBoxedMap +data class ItemsBoxedMap
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 5 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxedString](#itemsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ItemsBoxedVoid](#itemsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ItemsBoxedNumber](#itemsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ItemsBoxedBoolean](#itemsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ItemsBoxedMap](#itemsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsWithNullInstanceElements.md new file mode 100644 index 00000000000..c7321c84a46 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ItemsWithNullInstanceElements.md @@ -0,0 +1,159 @@ +# ItemsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.ItemsWithNullInstanceElements.java +class ItemsWithNullInstanceElements
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1Boxed](#itemswithnullinstanceelements1boxed)
sealed interface for validated payloads | +| record | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1BoxedList](#itemswithnullinstanceelements1boxedlist)
boxed class to store validated List payloads | +| static class | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1](#itemswithnullinstanceelements1)
schema class | +| static class | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsListBuilder](#itemswithnullinstanceelementslistbuilder)
builder for List payloads | +| static class | [ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist)
output class for List payloads | +| sealed interface | [ItemsWithNullInstanceElements.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [ItemsWithNullInstanceElements.ItemsBoxedVoid](#itemsboxedvoid)
boxed class to store validated null payloads | +| static class | [ItemsWithNullInstanceElements.Items](#items)
schema class | + +## ItemsWithNullInstanceElements1Boxed +sealed interface ItemsWithNullInstanceElements1Boxed
+permits
+[ItemsWithNullInstanceElements1BoxedList](#itemswithnullinstanceelements1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsWithNullInstanceElements1BoxedList +data class ItemsWithNullInstanceElements1BoxedList
+implements [ItemsWithNullInstanceElements1Boxed](#itemswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsWithNullInstanceElements1BoxedList([ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## ItemsWithNullInstanceElements1 +class ItemsWithNullInstanceElements1
+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.ItemsWithNullInstanceElements; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsList validatedPayload = + ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1.validate( + new ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsListBuilder() + .add(null) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) | validate(arg: [List<*>](#itemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [ItemsWithNullInstanceElements1BoxedList](#itemswithnullinstanceelements1boxedlist) | validateAndBox([List<*>](#itemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [ItemsWithNullInstanceElements1Boxed](#itemswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsWithNullInstanceElementsListBuilder +class ItemsWithNullInstanceElementsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsWithNullInstanceElementsListBuilder()
Creates an empty list | +| ItemsWithNullInstanceElementsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsWithNullInstanceElementsListBuilder | add(item: Nothing?) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsWithNullInstanceElementsList +class ItemsWithNullInstanceElementsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsWithNullInstanceElementsList](#itemswithnullinstanceelementslist) | of([List](#itemswithnullinstanceelementslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedVoid](#itemsboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedVoid +data class ItemsBoxedVoid
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md new file mode 100644 index 00000000000..6eddd588dff --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/JsonPointerFormat.md @@ -0,0 +1,169 @@ +# JsonPointerFormat +org.openapijsonschematools.client.components.schemas.JsonPointerFormat.java +class JsonPointerFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [JsonPointerFormat.JsonPointerFormat1Boxed](#jsonpointerformat1boxed)
sealed interface for validated payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid)
boxed class to store validated null payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber)
boxed class to store validated Number payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring)
boxed class to store validated String payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist)
boxed class to store validated List payloads | +| record | [JsonPointerFormat.JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [JsonPointerFormat.JsonPointerFormat1](#jsonpointerformat1)
schema class | + +## JsonPointerFormat1Boxed +sealed interface JsonPointerFormat1Boxed
+permits
+[JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid), +[JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean), +[JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber), +[JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring), +[JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist), +[JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## JsonPointerFormat1BoxedVoid +data class JsonPointerFormat1BoxedVoid
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedBoolean +data class JsonPointerFormat1BoxedBoolean
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedNumber +data class JsonPointerFormat1BoxedNumber
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedString +data class JsonPointerFormat1BoxedString
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedList +data class JsonPointerFormat1BoxedList
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1BoxedMap +data class JsonPointerFormat1BoxedMap
+implements [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| JsonPointerFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## JsonPointerFormat1 +class JsonPointerFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "json-pointer"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedString](#jsonpointerformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedVoid](#jsonpointerformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedNumber](#jsonpointerformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedBoolean](#jsonpointerformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedMap](#jsonpointerformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1BoxedList](#jsonpointerformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [JsonPointerFormat1Boxed](#jsonpointerformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md new file mode 100644 index 00000000000..5d7c780cf02 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxcontainsWithoutContainsIsIgnored.md @@ -0,0 +1,169 @@ +# MaxcontainsWithoutContainsIsIgnored +org.openapijsonschematools.client.components.schemas.MaxcontainsWithoutContainsIsIgnored.java +class MaxcontainsWithoutContainsIsIgnored
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed)
sealed interface for validated payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedVoid](#maxcontainswithoutcontainsisignored1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedBoolean](#maxcontainswithoutcontainsisignored1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedNumber](#maxcontainswithoutcontainsisignored1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedString](#maxcontainswithoutcontainsisignored1boxedstring)
boxed class to store validated String payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedList](#maxcontainswithoutcontainsisignored1boxedlist)
boxed class to store validated List payloads | +| record | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1BoxedMap](#maxcontainswithoutcontainsisignored1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1](#maxcontainswithoutcontainsisignored1)
schema class | + +## MaxcontainsWithoutContainsIsIgnored1Boxed +sealed interface MaxcontainsWithoutContainsIsIgnored1Boxed
+permits
+[MaxcontainsWithoutContainsIsIgnored1BoxedVoid](#maxcontainswithoutcontainsisignored1boxedvoid), +[MaxcontainsWithoutContainsIsIgnored1BoxedBoolean](#maxcontainswithoutcontainsisignored1boxedboolean), +[MaxcontainsWithoutContainsIsIgnored1BoxedNumber](#maxcontainswithoutcontainsisignored1boxednumber), +[MaxcontainsWithoutContainsIsIgnored1BoxedString](#maxcontainswithoutcontainsisignored1boxedstring), +[MaxcontainsWithoutContainsIsIgnored1BoxedList](#maxcontainswithoutcontainsisignored1boxedlist), +[MaxcontainsWithoutContainsIsIgnored1BoxedMap](#maxcontainswithoutcontainsisignored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxcontainsWithoutContainsIsIgnored1BoxedVoid +data class MaxcontainsWithoutContainsIsIgnored1BoxedVoid
+implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedBoolean +data class MaxcontainsWithoutContainsIsIgnored1BoxedBoolean
+implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedNumber +data class MaxcontainsWithoutContainsIsIgnored1BoxedNumber
+implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedString +data class MaxcontainsWithoutContainsIsIgnored1BoxedString
+implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedList +data class MaxcontainsWithoutContainsIsIgnored1BoxedList
+implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxcontainsWithoutContainsIsIgnored1BoxedMap +data class MaxcontainsWithoutContainsIsIgnored1BoxedMap
+implements [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxcontainsWithoutContainsIsIgnored1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxcontainsWithoutContainsIsIgnored1 +class MaxcontainsWithoutContainsIsIgnored1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxContains = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedString](#maxcontainswithoutcontainsisignored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedVoid](#maxcontainswithoutcontainsisignored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedNumber](#maxcontainswithoutcontainsisignored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedBoolean](#maxcontainswithoutcontainsisignored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedMap](#maxcontainswithoutcontainsisignored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1BoxedList](#maxcontainswithoutcontainsisignored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxcontainsWithoutContainsIsIgnored1Boxed](#maxcontainswithoutcontainsisignored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidation.md new file mode 100644 index 00000000000..30da56e71cc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidation.md @@ -0,0 +1,169 @@ +# MaximumValidation +org.openapijsonschematools.client.components.schemas.MaximumValidation.java +class MaximumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidation.MaximumValidation1Boxed](#maximumvalidation1boxed)
sealed interface for validated payloads | +| record | [MaximumValidation.MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaximumValidation.MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaximumValidation.MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaximumValidation.MaximumValidation1BoxedString](#maximumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaximumValidation.MaximumValidation1BoxedList](#maximumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaximumValidation.MaximumValidation1BoxedMap](#maximumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaximumValidation.MaximumValidation1](#maximumvalidation1)
schema class | + +## MaximumValidation1Boxed +sealed interface MaximumValidation1Boxed
+permits
+[MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid), +[MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean), +[MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber), +[MaximumValidation1BoxedString](#maximumvalidation1boxedstring), +[MaximumValidation1BoxedList](#maximumvalidation1boxedlist), +[MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidation1BoxedVoid +data class MaximumValidation1BoxedVoid
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedBoolean +data class MaximumValidation1BoxedBoolean
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedNumber +data class MaximumValidation1BoxedNumber
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedString +data class MaximumValidation1BoxedString
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedList +data class MaximumValidation1BoxedList
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1BoxedMap +data class MaximumValidation1BoxedMap
+implements [MaximumValidation1Boxed](#maximumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidation1 +class MaximumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 3.0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedString](#maximumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedVoid](#maximumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedNumber](#maximumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedBoolean](#maximumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedMap](#maximumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidation1BoxedList](#maximumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidation1Boxed](#maximumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md new file mode 100644 index 00000000000..c9730a8592b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaximumValidationWithUnsignedInteger.md @@ -0,0 +1,169 @@ +# MaximumValidationWithUnsignedInteger +org.openapijsonschematools.client.components.schemas.MaximumValidationWithUnsignedInteger.java +class MaximumValidationWithUnsignedInteger
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed)
sealed interface for validated payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid)
boxed class to store validated null payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber)
boxed class to store validated Number payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring)
boxed class to store validated String payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist)
boxed class to store validated List payloads | +| record | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1](#maximumvalidationwithunsignedinteger1)
schema class | + +## MaximumValidationWithUnsignedInteger1Boxed +sealed interface MaximumValidationWithUnsignedInteger1Boxed
+permits
+[MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid), +[MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean), +[MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber), +[MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring), +[MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist), +[MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaximumValidationWithUnsignedInteger1BoxedVoid +data class MaximumValidationWithUnsignedInteger1BoxedVoid
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedBoolean +data class MaximumValidationWithUnsignedInteger1BoxedBoolean
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedNumber +data class MaximumValidationWithUnsignedInteger1BoxedNumber
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedString +data class MaximumValidationWithUnsignedInteger1BoxedString
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedList +data class MaximumValidationWithUnsignedInteger1BoxedList
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1BoxedMap +data class MaximumValidationWithUnsignedInteger1BoxedMap
+implements [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaximumValidationWithUnsignedInteger1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaximumValidationWithUnsignedInteger1 +class MaximumValidationWithUnsignedInteger1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 300 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedString](#maximumvalidationwithunsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedVoid](#maximumvalidationwithunsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedNumber](#maximumvalidationwithunsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedBoolean](#maximumvalidationwithunsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedMap](#maximumvalidationwithunsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1BoxedList](#maximumvalidationwithunsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaximumValidationWithUnsignedInteger1Boxed](#maximumvalidationwithunsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md new file mode 100644 index 00000000000..3ea5955c1d2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxitemsValidation.md @@ -0,0 +1,169 @@ +# MaxitemsValidation +org.openapijsonschematools.client.components.schemas.MaxitemsValidation.java +class MaxitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxitemsValidation.MaxitemsValidation1Boxed](#maxitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxitemsValidation.MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxitemsValidation.MaxitemsValidation1](#maxitemsvalidation1)
schema class | + +## MaxitemsValidation1Boxed +sealed interface MaxitemsValidation1Boxed
+permits
+[MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid), +[MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean), +[MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber), +[MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring), +[MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist), +[MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxitemsValidation1BoxedVoid +data class MaxitemsValidation1BoxedVoid
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedBoolean +data class MaxitemsValidation1BoxedBoolean
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedNumber +data class MaxitemsValidation1BoxedNumber
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedString +data class MaxitemsValidation1BoxedString
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedList +data class MaxitemsValidation1BoxedList
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1BoxedMap +data class MaxitemsValidation1BoxedMap
+implements [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxitemsValidation1 +class MaxitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxItems = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedString](#maxitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedVoid](#maxitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedNumber](#maxitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedBoolean](#maxitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedMap](#maxitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1BoxedList](#maxitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxitemsValidation1Boxed](#maxitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md new file mode 100644 index 00000000000..bce5aed91d9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxlengthValidation.md @@ -0,0 +1,169 @@ +# MaxlengthValidation +org.openapijsonschematools.client.components.schemas.MaxlengthValidation.java +class MaxlengthValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxlengthValidation.MaxlengthValidation1Boxed](#maxlengthvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxlengthValidation.MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxlengthValidation.MaxlengthValidation1](#maxlengthvalidation1)
schema class | + +## MaxlengthValidation1Boxed +sealed interface MaxlengthValidation1Boxed
+permits
+[MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid), +[MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean), +[MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber), +[MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring), +[MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist), +[MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxlengthValidation1BoxedVoid +data class MaxlengthValidation1BoxedVoid
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedBoolean +data class MaxlengthValidation1BoxedBoolean
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedNumber +data class MaxlengthValidation1BoxedNumber
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedString +data class MaxlengthValidation1BoxedString
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedList +data class MaxlengthValidation1BoxedList
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1BoxedMap +data class MaxlengthValidation1BoxedMap
+implements [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxlengthValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxlengthValidation1 +class MaxlengthValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedString](#maxlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedVoid](#maxlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedNumber](#maxlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedBoolean](#maxlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedMap](#maxlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1BoxedList](#maxlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxlengthValidation1Boxed](#maxlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md new file mode 100644 index 00000000000..06a37326fda --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Maxproperties0MeansTheObjectIsEmpty.md @@ -0,0 +1,169 @@ +# Maxproperties0MeansTheObjectIsEmpty +org.openapijsonschematools.client.components.schemas.Maxproperties0MeansTheObjectIsEmpty.java +class Maxproperties0MeansTheObjectIsEmpty
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed)
sealed interface for validated payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid)
boxed class to store validated null payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber)
boxed class to store validated Number payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring)
boxed class to store validated String payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist)
boxed class to store validated List payloads | +| record | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap)
boxed class to store validated Map payloads | +| static class | [Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1](#maxproperties0meanstheobjectisempty1)
schema class | + +## Maxproperties0MeansTheObjectIsEmpty1Boxed +sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed
+permits
+[Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid), +[Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean), +[Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber), +[Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring), +[Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist), +[Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Maxproperties0MeansTheObjectIsEmpty1BoxedVoid +data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean +data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedNumber +data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedString +data class Maxproperties0MeansTheObjectIsEmpty1BoxedString
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedList +data class Maxproperties0MeansTheObjectIsEmpty1BoxedList
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1BoxedMap +data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap
+implements [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Maxproperties0MeansTheObjectIsEmpty1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Maxproperties0MeansTheObjectIsEmpty1 +class Maxproperties0MeansTheObjectIsEmpty1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedString](#maxproperties0meanstheobjectisempty1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedVoid](#maxproperties0meanstheobjectisempty1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedNumber](#maxproperties0meanstheobjectisempty1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean](#maxproperties0meanstheobjectisempty1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedMap](#maxproperties0meanstheobjectisempty1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1BoxedList](#maxproperties0meanstheobjectisempty1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Maxproperties0MeansTheObjectIsEmpty1Boxed](#maxproperties0meanstheobjectisempty1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md new file mode 100644 index 00000000000..8b04a4d21ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MaxpropertiesValidation.md @@ -0,0 +1,169 @@ +# MaxpropertiesValidation +org.openapijsonschematools.client.components.schemas.MaxpropertiesValidation.java +class MaxpropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MaxpropertiesValidation.MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MaxpropertiesValidation.MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MaxpropertiesValidation.MaxpropertiesValidation1](#maxpropertiesvalidation1)
schema class | + +## MaxpropertiesValidation1Boxed +sealed interface MaxpropertiesValidation1Boxed
+permits
+[MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid), +[MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean), +[MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber), +[MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring), +[MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist), +[MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MaxpropertiesValidation1BoxedVoid +data class MaxpropertiesValidation1BoxedVoid
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedBoolean +data class MaxpropertiesValidation1BoxedBoolean
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedNumber +data class MaxpropertiesValidation1BoxedNumber
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedString +data class MaxpropertiesValidation1BoxedString
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedList +data class MaxpropertiesValidation1BoxedList
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1BoxedMap +data class MaxpropertiesValidation1BoxedMap
+implements [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MaxpropertiesValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MaxpropertiesValidation1 +class MaxpropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxProperties = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedString](#maxpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedVoid](#maxpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedNumber](#maxpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedBoolean](#maxpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedMap](#maxpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1BoxedList](#maxpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MaxpropertiesValidation1Boxed](#maxpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MincontainsWithoutContainsIsIgnored.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MincontainsWithoutContainsIsIgnored.md new file mode 100644 index 00000000000..e7e2a699ba7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MincontainsWithoutContainsIsIgnored.md @@ -0,0 +1,169 @@ +# MincontainsWithoutContainsIsIgnored +org.openapijsonschematools.client.components.schemas.MincontainsWithoutContainsIsIgnored.java +class MincontainsWithoutContainsIsIgnored
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed)
sealed interface for validated payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedVoid](#mincontainswithoutcontainsisignored1boxedvoid)
boxed class to store validated null payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedBoolean](#mincontainswithoutcontainsisignored1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedNumber](#mincontainswithoutcontainsisignored1boxednumber)
boxed class to store validated Number payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedString](#mincontainswithoutcontainsisignored1boxedstring)
boxed class to store validated String payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedList](#mincontainswithoutcontainsisignored1boxedlist)
boxed class to store validated List payloads | +| record | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1BoxedMap](#mincontainswithoutcontainsisignored1boxedmap)
boxed class to store validated Map payloads | +| static class | [MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1](#mincontainswithoutcontainsisignored1)
schema class | + +## MincontainsWithoutContainsIsIgnored1Boxed +sealed interface MincontainsWithoutContainsIsIgnored1Boxed
+permits
+[MincontainsWithoutContainsIsIgnored1BoxedVoid](#mincontainswithoutcontainsisignored1boxedvoid), +[MincontainsWithoutContainsIsIgnored1BoxedBoolean](#mincontainswithoutcontainsisignored1boxedboolean), +[MincontainsWithoutContainsIsIgnored1BoxedNumber](#mincontainswithoutcontainsisignored1boxednumber), +[MincontainsWithoutContainsIsIgnored1BoxedString](#mincontainswithoutcontainsisignored1boxedstring), +[MincontainsWithoutContainsIsIgnored1BoxedList](#mincontainswithoutcontainsisignored1boxedlist), +[MincontainsWithoutContainsIsIgnored1BoxedMap](#mincontainswithoutcontainsisignored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MincontainsWithoutContainsIsIgnored1BoxedVoid +data class MincontainsWithoutContainsIsIgnored1BoxedVoid
+implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedBoolean +data class MincontainsWithoutContainsIsIgnored1BoxedBoolean
+implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedNumber +data class MincontainsWithoutContainsIsIgnored1BoxedNumber
+implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedString +data class MincontainsWithoutContainsIsIgnored1BoxedString
+implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedList +data class MincontainsWithoutContainsIsIgnored1BoxedList
+implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MincontainsWithoutContainsIsIgnored1BoxedMap +data class MincontainsWithoutContainsIsIgnored1BoxedMap
+implements [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MincontainsWithoutContainsIsIgnored1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MincontainsWithoutContainsIsIgnored1 +class MincontainsWithoutContainsIsIgnored1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minContains = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedString](#mincontainswithoutcontainsisignored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedVoid](#mincontainswithoutcontainsisignored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedNumber](#mincontainswithoutcontainsisignored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedBoolean](#mincontainswithoutcontainsisignored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedMap](#mincontainswithoutcontainsisignored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1BoxedList](#mincontainswithoutcontainsisignored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MincontainsWithoutContainsIsIgnored1Boxed](#mincontainswithoutcontainsisignored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidation.md new file mode 100644 index 00000000000..94694cf69ec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidation.md @@ -0,0 +1,169 @@ +# MinimumValidation +org.openapijsonschematools.client.components.schemas.MinimumValidation.java +class MinimumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidation.MinimumValidation1Boxed](#minimumvalidation1boxed)
sealed interface for validated payloads | +| record | [MinimumValidation.MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinimumValidation.MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinimumValidation.MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinimumValidation.MinimumValidation1BoxedString](#minimumvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinimumValidation.MinimumValidation1BoxedList](#minimumvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinimumValidation.MinimumValidation1BoxedMap](#minimumvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinimumValidation.MinimumValidation1](#minimumvalidation1)
schema class | + +## MinimumValidation1Boxed +sealed interface MinimumValidation1Boxed
+permits
+[MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid), +[MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean), +[MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber), +[MinimumValidation1BoxedString](#minimumvalidation1boxedstring), +[MinimumValidation1BoxedList](#minimumvalidation1boxedlist), +[MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidation1BoxedVoid +data class MinimumValidation1BoxedVoid
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedBoolean +data class MinimumValidation1BoxedBoolean
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedNumber +data class MinimumValidation1BoxedNumber
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedString +data class MinimumValidation1BoxedString
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedList +data class MinimumValidation1BoxedList
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1BoxedMap +data class MinimumValidation1BoxedMap
+implements [MinimumValidation1Boxed](#minimumvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidation1 +class MinimumValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 1.1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedString](#minimumvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedVoid](#minimumvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedNumber](#minimumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedBoolean](#minimumvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedMap](#minimumvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidation1BoxedList](#minimumvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidation1Boxed](#minimumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md new file mode 100644 index 00000000000..b898faa9cd1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinimumValidationWithSignedInteger.md @@ -0,0 +1,169 @@ +# MinimumValidationWithSignedInteger +org.openapijsonschematools.client.components.schemas.MinimumValidationWithSignedInteger.java +class MinimumValidationWithSignedInteger
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed)
sealed interface for validated payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid)
boxed class to store validated null payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber)
boxed class to store validated Number payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring)
boxed class to store validated String payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist)
boxed class to store validated List payloads | +| record | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1](#minimumvalidationwithsignedinteger1)
schema class | + +## MinimumValidationWithSignedInteger1Boxed +sealed interface MinimumValidationWithSignedInteger1Boxed
+permits
+[MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid), +[MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean), +[MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber), +[MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring), +[MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist), +[MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinimumValidationWithSignedInteger1BoxedVoid +data class MinimumValidationWithSignedInteger1BoxedVoid
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedBoolean +data class MinimumValidationWithSignedInteger1BoxedBoolean
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedNumber +data class MinimumValidationWithSignedInteger1BoxedNumber
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedString +data class MinimumValidationWithSignedInteger1BoxedString
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedList +data class MinimumValidationWithSignedInteger1BoxedList
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1BoxedMap +data class MinimumValidationWithSignedInteger1BoxedMap
+implements [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinimumValidationWithSignedInteger1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinimumValidationWithSignedInteger1 +class MinimumValidationWithSignedInteger1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedString](#minimumvalidationwithsignedinteger1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedVoid](#minimumvalidationwithsignedinteger1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedNumber](#minimumvalidationwithsignedinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedBoolean](#minimumvalidationwithsignedinteger1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedMap](#minimumvalidationwithsignedinteger1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1BoxedList](#minimumvalidationwithsignedinteger1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinimumValidationWithSignedInteger1Boxed](#minimumvalidationwithsignedinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md new file mode 100644 index 00000000000..e095c974cd9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinitemsValidation.md @@ -0,0 +1,169 @@ +# MinitemsValidation +org.openapijsonschematools.client.components.schemas.MinitemsValidation.java +class MinitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinitemsValidation.MinitemsValidation1Boxed](#minitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinitemsValidation.MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinitemsValidation.MinitemsValidation1](#minitemsvalidation1)
schema class | + +## MinitemsValidation1Boxed +sealed interface MinitemsValidation1Boxed
+permits
+[MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid), +[MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean), +[MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber), +[MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring), +[MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist), +[MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinitemsValidation1BoxedVoid +data class MinitemsValidation1BoxedVoid
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedBoolean +data class MinitemsValidation1BoxedBoolean
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedNumber +data class MinitemsValidation1BoxedNumber
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedString +data class MinitemsValidation1BoxedString
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedList +data class MinitemsValidation1BoxedList
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1BoxedMap +data class MinitemsValidation1BoxedMap
+implements [MinitemsValidation1Boxed](#minitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinitemsValidation1 +class MinitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minItems = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedString](#minitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedVoid](#minitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedNumber](#minitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedBoolean](#minitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedMap](#minitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinitemsValidation1BoxedList](#minitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinitemsValidation1Boxed](#minitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md new file mode 100644 index 00000000000..3905f4a2411 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinlengthValidation.md @@ -0,0 +1,169 @@ +# MinlengthValidation +org.openapijsonschematools.client.components.schemas.MinlengthValidation.java +class MinlengthValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinlengthValidation.MinlengthValidation1Boxed](#minlengthvalidation1boxed)
sealed interface for validated payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinlengthValidation.MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinlengthValidation.MinlengthValidation1](#minlengthvalidation1)
schema class | + +## MinlengthValidation1Boxed +sealed interface MinlengthValidation1Boxed
+permits
+[MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid), +[MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean), +[MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber), +[MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring), +[MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist), +[MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinlengthValidation1BoxedVoid +data class MinlengthValidation1BoxedVoid
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedBoolean +data class MinlengthValidation1BoxedBoolean
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedNumber +data class MinlengthValidation1BoxedNumber
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedString +data class MinlengthValidation1BoxedString
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedList +data class MinlengthValidation1BoxedList
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1BoxedMap +data class MinlengthValidation1BoxedMap
+implements [MinlengthValidation1Boxed](#minlengthvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinlengthValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinlengthValidation1 +class MinlengthValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedString](#minlengthvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedVoid](#minlengthvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedNumber](#minlengthvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedBoolean](#minlengthvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedMap](#minlengthvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinlengthValidation1BoxedList](#minlengthvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinlengthValidation1Boxed](#minlengthvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md new file mode 100644 index 00000000000..27161315772 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MinpropertiesValidation.md @@ -0,0 +1,169 @@ +# MinpropertiesValidation +org.openapijsonschematools.client.components.schemas.MinpropertiesValidation.java +class MinpropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MinpropertiesValidation.MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [MinpropertiesValidation.MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [MinpropertiesValidation.MinpropertiesValidation1](#minpropertiesvalidation1)
schema class | + +## MinpropertiesValidation1Boxed +sealed interface MinpropertiesValidation1Boxed
+permits
+[MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid), +[MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean), +[MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber), +[MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring), +[MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist), +[MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MinpropertiesValidation1BoxedVoid +data class MinpropertiesValidation1BoxedVoid
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedBoolean +data class MinpropertiesValidation1BoxedBoolean
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedNumber +data class MinpropertiesValidation1BoxedNumber
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedString +data class MinpropertiesValidation1BoxedString
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedList +data class MinpropertiesValidation1BoxedList
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1BoxedMap +data class MinpropertiesValidation1BoxedMap
+implements [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MinpropertiesValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MinpropertiesValidation1 +class MinpropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minProperties = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedString](#minpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedVoid](#minpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedNumber](#minpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedBoolean](#minpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedMap](#minpropertiesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1BoxedList](#minpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MinpropertiesValidation1Boxed](#minpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md new file mode 100644 index 00000000000..f55a9db95b1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleDependentsRequired.md @@ -0,0 +1,178 @@ +# MultipleDependentsRequired +org.openapijsonschematools.client.components.schemas.MultipleDependentsRequired.java +class MultipleDependentsRequired
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipleDependentsRequired.MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed)
sealed interface for validated payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedVoid](#multipledependentsrequired1boxedvoid)
boxed class to store validated null payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedBoolean](#multipledependentsrequired1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedNumber](#multipledependentsrequired1boxednumber)
boxed class to store validated Number payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedString](#multipledependentsrequired1boxedstring)
boxed class to store validated String payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedList](#multipledependentsrequired1boxedlist)
boxed class to store validated List payloads | +| record | [MultipleDependentsRequired.MultipleDependentsRequired1BoxedMap](#multipledependentsrequired1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipleDependentsRequired.MultipleDependentsRequired1](#multipledependentsrequired1)
schema class | + +## MultipleDependentsRequired1Boxed +sealed interface MultipleDependentsRequired1Boxed
+permits
+[MultipleDependentsRequired1BoxedVoid](#multipledependentsrequired1boxedvoid), +[MultipleDependentsRequired1BoxedBoolean](#multipledependentsrequired1boxedboolean), +[MultipleDependentsRequired1BoxedNumber](#multipledependentsrequired1boxednumber), +[MultipleDependentsRequired1BoxedString](#multipledependentsrequired1boxedstring), +[MultipleDependentsRequired1BoxedList](#multipledependentsrequired1boxedlist), +[MultipleDependentsRequired1BoxedMap](#multipledependentsrequired1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipleDependentsRequired1BoxedVoid +data class MultipleDependentsRequired1BoxedVoid
+implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleDependentsRequired1BoxedBoolean +data class MultipleDependentsRequired1BoxedBoolean
+implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleDependentsRequired1BoxedNumber +data class MultipleDependentsRequired1BoxedNumber
+implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleDependentsRequired1BoxedString +data class MultipleDependentsRequired1BoxedString
+implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleDependentsRequired1BoxedList +data class MultipleDependentsRequired1BoxedList
+implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleDependentsRequired1BoxedMap +data class MultipleDependentsRequired1BoxedMap
+implements [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleDependentsRequired1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleDependentsRequired1 +class MultipleDependentsRequired1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentRequired = mapOf(
+    Pair(
+        "quux",
+        setOf( +            "foo",
+            "bar"
+        ) +    )
+) + | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedString](#multipledependentsrequired1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedVoid](#multipledependentsrequired1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedNumber](#multipledependentsrequired1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedBoolean](#multipledependentsrequired1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedMap](#multipledependentsrequired1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1BoxedList](#multipledependentsrequired1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MultipleDependentsRequired1Boxed](#multipledependentsrequired1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md new file mode 100644 index 00000000000..9e89e2d1b98 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.md @@ -0,0 +1,362 @@ +# MultipleSimultaneousPatternpropertiesAreValidated +org.openapijsonschematools.client.components.schemas.MultipleSimultaneousPatternpropertiesAreValidated.java +class MultipleSimultaneousPatternpropertiesAreValidated
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed)
sealed interface for validated payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid](#multiplesimultaneouspatternpropertiesarevalidated1boxedvoid)
boxed class to store validated null payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean](#multiplesimultaneouspatternpropertiesarevalidated1boxedboolean)
boxed class to store validated boolean payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber](#multiplesimultaneouspatternpropertiesarevalidated1boxednumber)
boxed class to store validated Number payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedString](#multiplesimultaneouspatternpropertiesarevalidated1boxedstring)
boxed class to store validated String payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedList](#multiplesimultaneouspatternpropertiesarevalidated1boxedlist)
boxed class to store validated List payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap](#multiplesimultaneouspatternpropertiesarevalidated1boxedmap)
boxed class to store validated Map payloads | +| static class | [MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1](#multiplesimultaneouspatternpropertiesarevalidated1)
schema class | +| sealed interface | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxed](#aaaboxed)
sealed interface for validated payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedVoid](#aaaboxedvoid)
boxed class to store validated null payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedBoolean](#aaaboxedboolean)
boxed class to store validated boolean payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedNumber](#aaaboxednumber)
boxed class to store validated Number payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedString](#aaaboxedstring)
boxed class to store validated String payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedList](#aaaboxedlist)
boxed class to store validated List payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.AaaBoxedMap](#aaaboxedmap)
boxed class to store validated Map payloads | +| static class | [MultipleSimultaneousPatternpropertiesAreValidated.Aaa](#aaa)
schema class | +| sealed interface | [MultipleSimultaneousPatternpropertiesAreValidated.ABoxed](#aboxed)
sealed interface for validated payloads | +| record | [MultipleSimultaneousPatternpropertiesAreValidated.ABoxedNumber](#aboxednumber)
boxed class to store validated Number payloads | +| static class | [MultipleSimultaneousPatternpropertiesAreValidated.A](#a)
schema class | + +## MultipleSimultaneousPatternpropertiesAreValidated1Boxed +sealed interface MultipleSimultaneousPatternpropertiesAreValidated1Boxed
+permits
+[MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid](#multiplesimultaneouspatternpropertiesarevalidated1boxedvoid), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean](#multiplesimultaneouspatternpropertiesarevalidated1boxedboolean), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber](#multiplesimultaneouspatternpropertiesarevalidated1boxednumber), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedString](#multiplesimultaneouspatternpropertiesarevalidated1boxedstring), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedList](#multiplesimultaneouspatternpropertiesarevalidated1boxedlist), +[MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap](#multiplesimultaneouspatternpropertiesarevalidated1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid
+implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean
+implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber
+implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedString +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedString
+implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedList +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedList
+implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap +data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap
+implements [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleSimultaneousPatternpropertiesAreValidated1 +class MultipleSimultaneousPatternpropertiesAreValidated1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
    Pattern.compile("a*") to [A::class.java](#a)),
    Pattern.compile("aaa*") to [Aaa::class.java](#aaa))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedString](#multiplesimultaneouspatternpropertiesarevalidated1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid](#multiplesimultaneouspatternpropertiesarevalidated1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber](#multiplesimultaneouspatternpropertiesarevalidated1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean](#multiplesimultaneouspatternpropertiesarevalidated1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap](#multiplesimultaneouspatternpropertiesarevalidated1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1BoxedList](#multiplesimultaneouspatternpropertiesarevalidated1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [MultipleSimultaneousPatternpropertiesAreValidated1Boxed](#multiplesimultaneouspatternpropertiesarevalidated1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AaaBoxed +sealed interface AaaBoxed
+permits
+[AaaBoxedVoid](#aaaboxedvoid), +[AaaBoxedBoolean](#aaaboxedboolean), +[AaaBoxedNumber](#aaaboxednumber), +[AaaBoxedString](#aaaboxedstring), +[AaaBoxedList](#aaaboxedlist), +[AaaBoxedMap](#aaaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AaaBoxedVoid +data class AaaBoxedVoid
+implements [AaaBoxed](#aaaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AaaBoxedBoolean +data class AaaBoxedBoolean
+implements [AaaBoxed](#aaaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AaaBoxedNumber +data class AaaBoxedNumber
+implements [AaaBoxed](#aaaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AaaBoxedString +data class AaaBoxedString
+implements [AaaBoxed](#aaaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AaaBoxedList +data class AaaBoxedList
+implements [AaaBoxed](#aaaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AaaBoxedMap +data class AaaBoxedMap
+implements [AaaBoxed](#aaaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AaaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Aaa +class Aaa
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | maximum = 20 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [AaaBoxedString](#aaaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [AaaBoxedVoid](#aaaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [AaaBoxedNumber](#aaaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [AaaBoxedBoolean](#aaaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [AaaBoxedMap](#aaaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [AaaBoxedList](#aaaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [AaaBoxed](#aaaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ABoxed +sealed interface ABoxed
+permits
+[ABoxedNumber](#aboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ABoxedNumber +data class ABoxedNumber
+implements [ABoxed](#aboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ABoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## A +class A
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md new file mode 100644 index 00000000000..7b35e51a0c9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.md @@ -0,0 +1,111 @@ +# MultipleTypesCanBeSpecifiedInAnArray +org.openapijsonschematools.client.components.schemas.MultipleTypesCanBeSpecifiedInAnArray.java +class MultipleTypesCanBeSpecifiedInAnArray
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed)
sealed interface for validated payloads | +| record | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber](#multipletypescanbespecifiedinanarray1boxednumber)
boxed class to store validated Number payloads | +| record | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1BoxedString](#multipletypescanbespecifiedinanarray1boxedstring)
boxed class to store validated String payloads | +| static class | [MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1](#multipletypescanbespecifiedinanarray1)
schema class | + +## MultipleTypesCanBeSpecifiedInAnArray1Boxed +sealed interface MultipleTypesCanBeSpecifiedInAnArray1Boxed
+permits
+[MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber](#multipletypescanbespecifiedinanarray1boxednumber), +[MultipleTypesCanBeSpecifiedInAnArray1BoxedString](#multipletypescanbespecifiedinanarray1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber +data class MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber
+implements [MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleTypesCanBeSpecifiedInAnArray1BoxedString +data class MultipleTypesCanBeSpecifiedInAnArray1BoxedString
+implements [MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| MultipleTypesCanBeSpecifiedInAnArray1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## MultipleTypesCanBeSpecifiedInAnArray1 +class MultipleTypesCanBeSpecifiedInAnArray1
+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.MultipleTypesCanBeSpecifiedInAnArray; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.validate( + 1L, + configuration +); + +// String validation +String validatedPayload = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java,
    String::class.java
)
| +| String | type = "int"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber](#multipletypescanbespecifiedinanarray1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [MultipleTypesCanBeSpecifiedInAnArray1BoxedString](#multipletypescanbespecifiedinanarray1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [MultipleTypesCanBeSpecifiedInAnArray1Boxed](#multipletypescanbespecifiedinanarray1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md new file mode 100644 index 00000000000..708628006e4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAllofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAllofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAllofToCheckValidationSemantics.java +class NestedAllofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1](#nestedalloftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedAllofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedAllofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedAllofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedAllofToCheckValidationSemantics1Boxed +sealed interface NestedAllofToCheckValidationSemantics1Boxed
+permits
+[NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid), +[NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean), +[NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber), +[NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring), +[NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist), +[NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAllofToCheckValidationSemantics1BoxedVoid +data class NestedAllofToCheckValidationSemantics1BoxedVoid
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedBoolean +data class NestedAllofToCheckValidationSemantics1BoxedBoolean
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedNumber +data class NestedAllofToCheckValidationSemantics1BoxedNumber
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedString +data class NestedAllofToCheckValidationSemantics1BoxedString
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedList +data class NestedAllofToCheckValidationSemantics1BoxedList
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1BoxedMap +data class NestedAllofToCheckValidationSemantics1BoxedMap
+implements [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAllofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAllofToCheckValidationSemantics1 +class NestedAllofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedString](#nestedalloftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedVoid](#nestedalloftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedNumber](#nestedalloftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedBoolean](#nestedalloftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedMap](#nestedalloftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1BoxedList](#nestedalloftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAllofToCheckValidationSemantics1Boxed](#nestedalloftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema01::class.java](#schema01)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md new file mode 100644 index 00000000000..d145f8fdf0a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedAnyofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedAnyofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedAnyofToCheckValidationSemantics.java +class NestedAnyofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1](#nestedanyoftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedAnyofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedAnyofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedAnyofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedAnyofToCheckValidationSemantics1Boxed +sealed interface NestedAnyofToCheckValidationSemantics1Boxed
+permits
+[NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid), +[NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean), +[NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber), +[NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring), +[NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist), +[NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedAnyofToCheckValidationSemantics1BoxedVoid +data class NestedAnyofToCheckValidationSemantics1BoxedVoid
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedBoolean +data class NestedAnyofToCheckValidationSemantics1BoxedBoolean
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedNumber +data class NestedAnyofToCheckValidationSemantics1BoxedNumber
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedString +data class NestedAnyofToCheckValidationSemantics1BoxedString
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedList +data class NestedAnyofToCheckValidationSemantics1BoxedList
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1BoxedMap +data class NestedAnyofToCheckValidationSemantics1BoxedMap
+implements [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedAnyofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedAnyofToCheckValidationSemantics1 +class NestedAnyofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema0::class.java](#schema0)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedString](#nestedanyoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedVoid](#nestedanyoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedNumber](#nestedanyoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedBoolean](#nestedanyoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedMap](#nestedanyoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1BoxedList](#nestedanyoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedAnyofToCheckValidationSemantics1Boxed](#nestedanyoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | anyOf = listOf(
    [Schema01::class.java](#schema01)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedItems.md new file mode 100644 index 00000000000..f609bc5ec46 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedItems.md @@ -0,0 +1,492 @@ +# NestedItems +org.openapijsonschematools.client.components.schemas.NestedItems.java +class NestedItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [NestedItems.NestedItems1Boxed](#nesteditems1boxed)
sealed interface for validated payloads | +| record | [NestedItems.NestedItems1BoxedList](#nesteditems1boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.NestedItems1](#nesteditems1)
schema class | +| static class | [NestedItems.NestedItemsListBuilder](#nesteditemslistbuilder)
builder for List payloads | +| static class | [NestedItems.NestedItemsList](#nesteditemslist)
output class for List payloads | +| sealed interface | [NestedItems.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [NestedItems.ItemsBoxedList](#itemsboxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items](#items)
schema class | +| static class | [NestedItems.ItemsListBuilder2](#itemslistbuilder2)
builder for List payloads | +| static class | [NestedItems.ItemsList2](#itemslist2)
output class for List payloads | +| sealed interface | [NestedItems.Items1Boxed](#items1boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items1BoxedList](#items1boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items1](#items1)
schema class | +| static class | [NestedItems.ItemsListBuilder1](#itemslistbuilder1)
builder for List payloads | +| static class | [NestedItems.ItemsList1](#itemslist1)
output class for List payloads | +| sealed interface | [NestedItems.Items2Boxed](#items2boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items2BoxedList](#items2boxedlist)
boxed class to store validated List payloads | +| static class | [NestedItems.Items2](#items2)
schema class | +| static class | [NestedItems.ItemsListBuilder](#itemslistbuilder)
builder for List payloads | +| static class | [NestedItems.ItemsList](#itemslist)
output class for List payloads | +| sealed interface | [NestedItems.Items3Boxed](#items3boxed)
sealed interface for validated payloads | +| record | [NestedItems.Items3BoxedNumber](#items3boxednumber)
boxed class to store validated Number payloads | +| static class | [NestedItems.Items3](#items3)
schema class | + +## NestedItems1Boxed +sealed interface NestedItems1Boxed
+permits
+[NestedItems1BoxedList](#nesteditems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## NestedItems1BoxedList +data class NestedItems1BoxedList
+implements [NestedItems1Boxed](#nesteditems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItems1BoxedList([NestedItemsList](#nesteditemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedItems1 +class NestedItems1
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.NestedItemsList validatedPayload = + NestedItems.NestedItems1.validate( + new NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NestedItemsList](#nesteditemslist) | validate(arg: [List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1BoxedList](#nesteditems1boxedlist) | validateAndBox([List<*>](#nesteditemslistbuilder), configuration: SchemaConfiguration) | +| [NestedItems1Boxed](#nesteditems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NestedItemsListBuilder +class NestedItemsListBuilder
+builder for `List>>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedItemsListBuilder()
Creates an empty list | +| NestedItemsListBuilder(List>>> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| NestedItemsListBuilder | add(item: List>>) | +| List>>> | build()
Returns list input that should be used with Schema.validate | + +## NestedItemsList +class NestedItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NestedItemsList](#nesteditemslist) | of([List>>>](#nesteditemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedList](#itemsboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedList +data class ItemsBoxedList
+implements [ItemsBoxed](#itemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsBoxedList([ItemsList2](#itemslist2) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items +class Items
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList2 validatedPayload = + NestedItems.Items.validate( + new NestedItems.ItemsListBuilder2() + .add( + listOf( + listOf( + 1 + ) + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items1::class.java](#items1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList2](#itemslist2) | validate(arg: [List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxedList](#itemsboxedlist) | validateAndBox([List<*>](#itemslistbuilder2), configuration: SchemaConfiguration) | +| [ItemsBoxed](#itemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder2 +class ItemsListBuilder2
+builder for `List>>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder2()
Creates an empty list | +| ItemsListBuilder2(List>> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder2 | add(item: List>) | +| List>> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList2 +class ItemsList2
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList2](#itemslist2) | of([List>>](#itemslistbuilder2) arg, SchemaConfiguration configuration) | + +## Items1Boxed +sealed interface Items1Boxed
+permits
+[Items1BoxedList](#items1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items1BoxedList +data class Items1BoxedList
+implements [Items1Boxed](#items1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items1BoxedList([ItemsList1](#itemslist1) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items1 +class Items1
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList1 validatedPayload = + NestedItems.Items1.validate( + new NestedItems.ItemsListBuilder1() + .add( + listOf( + 1 + ) + ) + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items2::class.java](#items2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList1](#itemslist1) | validate(arg: [List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1BoxedList](#items1boxedlist) | validateAndBox([List<*>](#itemslistbuilder1), configuration: SchemaConfiguration) | +| [Items1Boxed](#items1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder1 +class ItemsListBuilder1
+builder for `List>` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder1()
Creates an empty list | +| ItemsListBuilder1(List> items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder1 | add(item: List) | +| List> | build()
Returns list input that should be used with Schema.validate | + +## ItemsList1 +class ItemsList1
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList1](#itemslist1) | of([List>](#itemslistbuilder1) arg, SchemaConfiguration configuration) | + +## Items2Boxed +sealed interface Items2Boxed
+permits
+[Items2BoxedList](#items2boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## Items2BoxedList +data class Items2BoxedList
+implements [Items2Boxed](#items2boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items2BoxedList([ItemsList](#itemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## Items2 +class Items2
+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.NestedItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +NestedItems.ItemsList validatedPayload = + NestedItems.Items2.validate( + new NestedItems.ItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items3::class.java](#items3) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ItemsList](#itemslist) | validate(arg: [List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2BoxedList](#items2boxedlist) | validateAndBox([List<*>](#itemslistbuilder), configuration: SchemaConfiguration) | +| [Items2Boxed](#items2boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ItemsListBuilder +class ItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ItemsListBuilder()
Creates an empty list | +| ItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ItemsListBuilder | add(item: Int) | +| ItemsListBuilder | add(item: Float) | +| ItemsListBuilder | add(item: Long) | +| ItemsListBuilder | add(item: Double) | +| List | build()
Returns list input that should be used with Schema.validate | + +## ItemsList +class ItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ItemsList](#itemslist) | of([List](#itemslistbuilder) arg, SchemaConfiguration configuration) | + +## Items3Boxed +sealed interface Items3Boxed
+permits
+[Items3BoxedNumber](#items3boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Items3BoxedNumber +data class Items3BoxedNumber
+implements [Items3Boxed](#items3boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Items3BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Items3 +class Items3
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md new file mode 100644 index 00000000000..6e78e1ba783 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NestedOneofToCheckValidationSemantics.md @@ -0,0 +1,362 @@ +# NestedOneofToCheckValidationSemantics +org.openapijsonschematools.client.components.schemas.NestedOneofToCheckValidationSemantics.java +class NestedOneofToCheckValidationSemantics
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid)
boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber)
boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring)
boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist)
boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1](#nestedoneoftocheckvalidationsemantics1)
schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema0](#schema0)
schema class | +| sealed interface | [NestedOneofToCheckValidationSemantics.Schema01Boxed](#schema01boxed)
sealed interface for validated payloads | +| record | [NestedOneofToCheckValidationSemantics.Schema01BoxedVoid](#schema01boxedvoid)
boxed class to store validated null payloads | +| static class | [NestedOneofToCheckValidationSemantics.Schema01](#schema01)
schema class | + +## NestedOneofToCheckValidationSemantics1Boxed +sealed interface NestedOneofToCheckValidationSemantics1Boxed
+permits
+[NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid), +[NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean), +[NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber), +[NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring), +[NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist), +[NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NestedOneofToCheckValidationSemantics1BoxedVoid +data class NestedOneofToCheckValidationSemantics1BoxedVoid
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedBoolean +data class NestedOneofToCheckValidationSemantics1BoxedBoolean
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedNumber +data class NestedOneofToCheckValidationSemantics1BoxedNumber
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedString +data class NestedOneofToCheckValidationSemantics1BoxedString
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedList +data class NestedOneofToCheckValidationSemantics1BoxedList
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1BoxedMap +data class NestedOneofToCheckValidationSemantics1BoxedMap
+implements [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NestedOneofToCheckValidationSemantics1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NestedOneofToCheckValidationSemantics1 +class NestedOneofToCheckValidationSemantics1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedString](#nestedoneoftocheckvalidationsemantics1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedVoid](#nestedoneoftocheckvalidationsemantics1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedNumber](#nestedoneoftocheckvalidationsemantics1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedBoolean](#nestedoneoftocheckvalidationsemantics1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedMap](#nestedoneoftocheckvalidationsemantics1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1BoxedList](#nestedoneoftocheckvalidationsemantics1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NestedOneofToCheckValidationSemantics1Boxed](#nestedoneoftocheckvalidationsemantics1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema01::class.java](#schema01)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema01Boxed +sealed interface Schema01Boxed
+permits
+[Schema01BoxedVoid](#schema01boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema01BoxedVoid +data class Schema01BoxedVoid
+implements [Schema01Boxed](#schema01boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema01BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema01 +class Schema01
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md new file mode 100644 index 00000000000..86530abe5e7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonAsciiPatternWithAdditionalproperties.md @@ -0,0 +1,384 @@ +# NonAsciiPatternWithAdditionalproperties +org.openapijsonschematools.client.components.schemas.NonAsciiPatternWithAdditionalproperties.java +class NonAsciiPatternWithAdditionalproperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1Boxed](#nonasciipatternwithadditionalproperties1boxed)
sealed interface for validated payloads | +| record | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1BoxedMap](#nonasciipatternwithadditionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1](#nonasciipatternwithadditionalproperties1)
schema class | +| static class | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMapBuilder](#nonasciipatternwithadditionalpropertiesmapbuilder)
builder for Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap)
output class for Map payloads | +| sealed interface | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed)
sealed interface for validated payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid](#circumflexaccentlatinsmallletterawithacuteboxedvoid)
boxed class to store validated null payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean](#circumflexaccentlatinsmallletterawithacuteboxedboolean)
boxed class to store validated boolean payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber](#circumflexaccentlatinsmallletterawithacuteboxednumber)
boxed class to store validated Number payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedString](#circumflexaccentlatinsmallletterawithacuteboxedstring)
boxed class to store validated String payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedList](#circumflexaccentlatinsmallletterawithacuteboxedlist)
boxed class to store validated List payloads | +| record | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap](#circumflexaccentlatinsmallletterawithacuteboxedmap)
boxed class to store validated Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.CircumflexAccentLatinSmallLetterAWithAcute](#circumflexaccentlatinsmallletterawithacute)
schema class | +| sealed interface | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [NonAsciiPatternWithAdditionalproperties.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [NonAsciiPatternWithAdditionalproperties.AdditionalProperties](#additionalproperties)
schema class | + +## NonAsciiPatternWithAdditionalproperties1Boxed +sealed interface NonAsciiPatternWithAdditionalproperties1Boxed
+permits
+[NonAsciiPatternWithAdditionalproperties1BoxedMap](#nonasciipatternwithadditionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NonAsciiPatternWithAdditionalproperties1BoxedMap +data class NonAsciiPatternWithAdditionalproperties1BoxedMap
+implements [NonAsciiPatternWithAdditionalproperties1Boxed](#nonasciipatternwithadditionalproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonAsciiPatternWithAdditionalproperties1BoxedMap([NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## NonAsciiPatternWithAdditionalproperties1 +class NonAsciiPatternWithAdditionalproperties1
+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.NonAsciiPatternWithAdditionalproperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMap validatedPayload = + NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1.validate( + new NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalpropertiesMapBuilder() + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| Map> | patternProperties = mapOf(
    Pattern.compile("^á") to [CircumflexAccentLatinSmallLetterAWithAcute::class.java](#circumflexaccentlatinsmallletterawithacute))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | validate(arg: [Map<?, ?>](#nonasciipatternwithadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [NonAsciiPatternWithAdditionalproperties1BoxedMap](#nonasciipatternwithadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#nonasciipatternwithadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [NonAsciiPatternWithAdditionalproperties1Boxed](#nonasciipatternwithadditionalproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NonAsciiPatternWithAdditionalpropertiesMapBuilder +class NonAsciiPatternWithAdditionalpropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonAsciiPatternWithAdditionalpropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | + +## NonAsciiPatternWithAdditionalpropertiesMap +class NonAsciiPatternWithAdditionalpropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NonAsciiPatternWithAdditionalpropertiesMap](#nonasciipatternwithadditionalpropertiesmap) | of([Map](#nonasciipatternwithadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxed +sealed interface CircumflexAccentLatinSmallLetterAWithAcuteBoxed
+permits
+[CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid](#circumflexaccentlatinsmallletterawithacuteboxedvoid), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean](#circumflexaccentlatinsmallletterawithacuteboxedboolean), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber](#circumflexaccentlatinsmallletterawithacuteboxednumber), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedString](#circumflexaccentlatinsmallletterawithacuteboxedstring), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedList](#circumflexaccentlatinsmallletterawithacuteboxedlist), +[CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap](#circumflexaccentlatinsmallletterawithacuteboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid
+implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean
+implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber
+implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedString +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedString
+implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedList +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedList
+implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap +data class CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap
+implements [CircumflexAccentLatinSmallLetterAWithAcuteBoxed](#circumflexaccentlatinsmallletterawithacuteboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| CircumflexAccentLatinSmallLetterAWithAcuteBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## CircumflexAccentLatinSmallLetterAWithAcute +class CircumflexAccentLatinSmallLetterAWithAcute
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid), +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean), +[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber), +[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring), +[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist), +[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedString +data class AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedList +data class AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedMap +data class AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md new file mode 100644 index 00000000000..39f210a06d0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NonInterferenceAcrossCombinedSchemas.md @@ -0,0 +1,1099 @@ +# NonInterferenceAcrossCombinedSchemas +org.openapijsonschematools.client.components.schemas.NonInterferenceAcrossCombinedSchemas.java +class NonInterferenceAcrossCombinedSchemas
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed)
sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedVoid](#noninterferenceacrosscombinedschemas1boxedvoid)
boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedBoolean](#noninterferenceacrosscombinedschemas1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedNumber](#noninterferenceacrosscombinedschemas1boxednumber)
boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedString](#noninterferenceacrosscombinedschemas1boxedstring)
boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedList](#noninterferenceacrosscombinedschemas1boxedlist)
boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1BoxedMap](#noninterferenceacrosscombinedschemas1boxedmap)
boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1](#noninterferenceacrosscombinedschemas1)
schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.Schema2Boxed](#schema2boxed)
sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedVoid](#schema2boxedvoid)
boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedBoolean](#schema2boxedboolean)
boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedNumber](#schema2boxednumber)
boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedString](#schema2boxedstring)
boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedList](#schema2boxedlist)
boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema2BoxedMap](#schema2boxedmap)
boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Schema2](#schema2)
schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxed](#elseschemaboxed)
sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedNumber](#elseschemaboxednumber)
boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedString](#elseschemaboxedstring)
boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedList](#elseschemaboxedlist)
boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ElseSchemaBoxedMap](#elseschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.ElseSchema](#elseschema)
schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Schema1](#schema1)
schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.ThenBoxed](#thenboxed)
sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedVoid](#thenboxedvoid)
boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedBoolean](#thenboxedboolean)
boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedNumber](#thenboxednumber)
boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedString](#thenboxedstring)
boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedList](#thenboxedlist)
boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.ThenBoxedMap](#thenboxedmap)
boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Then](#then)
schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.Schema0](#schema0)
schema class | +| sealed interface | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxed](#ifschemaboxed)
sealed interface for validated payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedVoid](#ifschemaboxedvoid)
boxed class to store validated null payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedNumber](#ifschemaboxednumber)
boxed class to store validated Number payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedString](#ifschemaboxedstring)
boxed class to store validated String payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedList](#ifschemaboxedlist)
boxed class to store validated List payloads | +| record | [NonInterferenceAcrossCombinedSchemas.IfSchemaBoxedMap](#ifschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [NonInterferenceAcrossCombinedSchemas.IfSchema](#ifschema)
schema class | + +## NonInterferenceAcrossCombinedSchemas1Boxed +sealed interface NonInterferenceAcrossCombinedSchemas1Boxed
+permits
+[NonInterferenceAcrossCombinedSchemas1BoxedVoid](#noninterferenceacrosscombinedschemas1boxedvoid), +[NonInterferenceAcrossCombinedSchemas1BoxedBoolean](#noninterferenceacrosscombinedschemas1boxedboolean), +[NonInterferenceAcrossCombinedSchemas1BoxedNumber](#noninterferenceacrosscombinedschemas1boxednumber), +[NonInterferenceAcrossCombinedSchemas1BoxedString](#noninterferenceacrosscombinedschemas1boxedstring), +[NonInterferenceAcrossCombinedSchemas1BoxedList](#noninterferenceacrosscombinedschemas1boxedlist), +[NonInterferenceAcrossCombinedSchemas1BoxedMap](#noninterferenceacrosscombinedschemas1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NonInterferenceAcrossCombinedSchemas1BoxedVoid +data class NonInterferenceAcrossCombinedSchemas1BoxedVoid
+implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedBoolean +data class NonInterferenceAcrossCombinedSchemas1BoxedBoolean
+implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedNumber +data class NonInterferenceAcrossCombinedSchemas1BoxedNumber
+implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedString +data class NonInterferenceAcrossCombinedSchemas1BoxedString
+implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedList +data class NonInterferenceAcrossCombinedSchemas1BoxedList
+implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NonInterferenceAcrossCombinedSchemas1BoxedMap +data class NonInterferenceAcrossCombinedSchemas1BoxedMap
+implements [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NonInterferenceAcrossCombinedSchemas1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NonInterferenceAcrossCombinedSchemas1 +class NonInterferenceAcrossCombinedSchemas1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1),
    [Schema2::class.java](#schema2)
;)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedString](#noninterferenceacrosscombinedschemas1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedVoid](#noninterferenceacrosscombinedschemas1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedNumber](#noninterferenceacrosscombinedschemas1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedBoolean](#noninterferenceacrosscombinedschemas1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedMap](#noninterferenceacrosscombinedschemas1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1BoxedList](#noninterferenceacrosscombinedschemas1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NonInterferenceAcrossCombinedSchemas1Boxed](#noninterferenceacrosscombinedschemas1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema2Boxed +sealed interface Schema2Boxed
+permits
+[Schema2BoxedVoid](#schema2boxedvoid), +[Schema2BoxedBoolean](#schema2boxedboolean), +[Schema2BoxedNumber](#schema2boxednumber), +[Schema2BoxedString](#schema2boxedstring), +[Schema2BoxedList](#schema2boxedlist), +[Schema2BoxedMap](#schema2boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema2BoxedVoid +data class Schema2BoxedVoid
+implements [Schema2Boxed](#schema2boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema2BoxedBoolean +data class Schema2BoxedBoolean
+implements [Schema2Boxed](#schema2boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema2BoxedNumber +data class Schema2BoxedNumber
+implements [Schema2Boxed](#schema2boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema2BoxedString +data class Schema2BoxedString
+implements [Schema2Boxed](#schema2boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema2BoxedList +data class Schema2BoxedList
+implements [Schema2Boxed](#schema2boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema2BoxedMap +data class Schema2BoxedMap
+implements [Schema2Boxed](#schema2boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema2BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema2 +class Schema2
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema2BoxedString](#schema2boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema2BoxedVoid](#schema2boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema2BoxedNumber](#schema2boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema2BoxedBoolean](#schema2boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema2BoxedMap](#schema2boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema2BoxedList](#schema2boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema2Boxed](#schema2boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
+permits
+[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
+implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchema +class ElseSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | then = [Then::class.java](#then) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
+permits
+[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
+implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
+implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedString +data class ThenBoxedString
+implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedList +data class ThenBoxedList
+implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Then +class Then
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
+permits
+[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
+implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchema +class IfSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Not.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Not.md new file mode 100644 index 00000000000..4e1250b94c4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Not.md @@ -0,0 +1,207 @@ +# Not +org.openapijsonschematools.client.components.schemas.Not.java +class Not
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Not.Not1Boxed](#not1boxed)
sealed interface for validated payloads | +| record | [Not.Not1BoxedVoid](#not1boxedvoid)
boxed class to store validated null payloads | +| record | [Not.Not1BoxedBoolean](#not1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Not.Not1BoxedNumber](#not1boxednumber)
boxed class to store validated Number payloads | +| record | [Not.Not1BoxedString](#not1boxedstring)
boxed class to store validated String payloads | +| record | [Not.Not1BoxedList](#not1boxedlist)
boxed class to store validated List payloads | +| record | [Not.Not1BoxedMap](#not1boxedmap)
boxed class to store validated Map payloads | +| static class | [Not.Not1](#not1)
schema class | +| sealed interface | [Not.Not2Boxed](#not2boxed)
sealed interface for validated payloads | +| record | [Not.Not2BoxedNumber](#not2boxednumber)
boxed class to store validated Number payloads | +| static class | [Not.Not2](#not2)
schema class | + +## Not1Boxed +sealed interface Not1Boxed
+permits
+[Not1BoxedVoid](#not1boxedvoid), +[Not1BoxedBoolean](#not1boxedboolean), +[Not1BoxedNumber](#not1boxednumber), +[Not1BoxedString](#not1boxedstring), +[Not1BoxedList](#not1boxedlist), +[Not1BoxedMap](#not1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Not1BoxedVoid +data class Not1BoxedVoid
+implements [Not1Boxed](#not1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedBoolean +data class Not1BoxedBoolean
+implements [Not1Boxed](#not1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedNumber +data class Not1BoxedNumber
+implements [Not1Boxed](#not1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedString +data class Not1BoxedString
+implements [Not1Boxed](#not1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedList +data class Not1BoxedList
+implements [Not1Boxed](#not1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1BoxedMap +data class Not1BoxedMap
+implements [Not1Boxed](#not1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Not1 +class Not1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not2::class.java](#not2) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Not1BoxedString](#not1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Not1BoxedVoid](#not1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Not1BoxedNumber](#not1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Not1BoxedBoolean](#not1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Not1BoxedMap](#not1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Not1BoxedList](#not1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Not1Boxed](#not1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Not2Boxed +sealed interface Not2Boxed
+permits
+[Not2BoxedNumber](#not2boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Not2BoxedNumber +data class Not2BoxedNumber
+implements [Not2Boxed](#not2boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Not2BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Not2 +class Not2
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md new file mode 100644 index 00000000000..2578fcfd7c1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMoreComplexSchema.md @@ -0,0 +1,324 @@ +# NotMoreComplexSchema +org.openapijsonschematools.client.components.schemas.NotMoreComplexSchema.java +class NotMoreComplexSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [NotMoreComplexSchema.NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid)
boxed class to store validated null payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber)
boxed class to store validated Number payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring)
boxed class to store validated String payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist)
boxed class to store validated List payloads | +| record | [NotMoreComplexSchema.NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.NotMoreComplexSchema1](#notmorecomplexschema1)
schema class | +| sealed interface | [NotMoreComplexSchema.NotBoxed](#notboxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.NotBoxedMap](#notboxedmap)
boxed class to store validated Map payloads | +| static class | [NotMoreComplexSchema.Not](#not)
schema class | +| static class | [NotMoreComplexSchema.NotMapBuilder](#notmapbuilder)
builder for Map payloads | +| static class | [NotMoreComplexSchema.NotMap](#notmap)
output class for Map payloads | +| sealed interface | [NotMoreComplexSchema.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [NotMoreComplexSchema.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [NotMoreComplexSchema.Foo](#foo)
schema class | + +## NotMoreComplexSchema1Boxed +sealed interface NotMoreComplexSchema1Boxed
+permits
+[NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid), +[NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean), +[NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber), +[NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring), +[NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist), +[NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotMoreComplexSchema1BoxedVoid +data class NotMoreComplexSchema1BoxedVoid
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedBoolean +data class NotMoreComplexSchema1BoxedBoolean
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedNumber +data class NotMoreComplexSchema1BoxedNumber
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedString +data class NotMoreComplexSchema1BoxedString
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedList +data class NotMoreComplexSchema1BoxedList
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1BoxedMap +data class NotMoreComplexSchema1BoxedMap
+implements [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMoreComplexSchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMoreComplexSchema1 +class NotMoreComplexSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedString](#notmorecomplexschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedVoid](#notmorecomplexschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedNumber](#notmorecomplexschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedBoolean](#notmorecomplexschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedMap](#notmorecomplexschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1BoxedList](#notmorecomplexschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NotMoreComplexSchema1Boxed](#notmorecomplexschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
+permits
+[NotBoxedMap](#notboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedMap +data class NotBoxedMap
+implements [NotBoxed](#notboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedMap([NotMap](#notmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## Not +class Not
+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.NotMoreComplexSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +NotMoreComplexSchema.NotMap validatedPayload = + NotMoreComplexSchema.Not.validate( + new NotMoreComplexSchema.NotMapBuilder() + .foo("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [NotMap](#notmap) | validate(arg: [Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxedMap](#notboxedmap) | validateAndBox([Map<?, ?>](#notmapbuilder), configuration: SchemaConfiguration) | +| [NotBoxed](#notboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotMapBuilder +class NotMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [NotMapBuilder](#notmapbuilder) | foo(value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: String) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Int) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Float) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Long) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Double) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: List) | +| [NotMapBuilder](#notmapbuilder) | additionalProperty(key: String, value: Map) | + +## NotMap +class NotMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [NotMap](#notmap) | of([Map](#notmapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMultipleTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMultipleTypes.md new file mode 100644 index 00000000000..441488b38d5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NotMultipleTypes.md @@ -0,0 +1,266 @@ +# NotMultipleTypes +org.openapijsonschematools.client.components.schemas.NotMultipleTypes.java +class NotMultipleTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NotMultipleTypes.NotMultipleTypes1Boxed](#notmultipletypes1boxed)
sealed interface for validated payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedVoid](#notmultipletypes1boxedvoid)
boxed class to store validated null payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedBoolean](#notmultipletypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedNumber](#notmultipletypes1boxednumber)
boxed class to store validated Number payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedString](#notmultipletypes1boxedstring)
boxed class to store validated String payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedList](#notmultipletypes1boxedlist)
boxed class to store validated List payloads | +| record | [NotMultipleTypes.NotMultipleTypes1BoxedMap](#notmultipletypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [NotMultipleTypes.NotMultipleTypes1](#notmultipletypes1)
schema class | +| sealed interface | [NotMultipleTypes.NotBoxed](#notboxed)
sealed interface for validated payloads | +| record | [NotMultipleTypes.NotBoxedNumber](#notboxednumber)
boxed class to store validated Number payloads | +| record | [NotMultipleTypes.NotBoxedBoolean](#notboxedboolean)
boxed class to store validated boolean payloads | +| static class | [NotMultipleTypes.Not](#not)
schema class | + +## NotMultipleTypes1Boxed +sealed interface NotMultipleTypes1Boxed
+permits
+[NotMultipleTypes1BoxedVoid](#notmultipletypes1boxedvoid), +[NotMultipleTypes1BoxedBoolean](#notmultipletypes1boxedboolean), +[NotMultipleTypes1BoxedNumber](#notmultipletypes1boxednumber), +[NotMultipleTypes1BoxedString](#notmultipletypes1boxedstring), +[NotMultipleTypes1BoxedList](#notmultipletypes1boxedlist), +[NotMultipleTypes1BoxedMap](#notmultipletypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## NotMultipleTypes1BoxedVoid +data class NotMultipleTypes1BoxedVoid
+implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMultipleTypes1BoxedBoolean +data class NotMultipleTypes1BoxedBoolean
+implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMultipleTypes1BoxedNumber +data class NotMultipleTypes1BoxedNumber
+implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMultipleTypes1BoxedString +data class NotMultipleTypes1BoxedString
+implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMultipleTypes1BoxedList +data class NotMultipleTypes1BoxedList
+implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMultipleTypes1BoxedMap +data class NotMultipleTypes1BoxedMap
+implements [NotMultipleTypes1Boxed](#notmultipletypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotMultipleTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## NotMultipleTypes1 +class NotMultipleTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | not = [Not::class.java](#not) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedString](#notmultipletypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedVoid](#notmultipletypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedNumber](#notmultipletypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedBoolean](#notmultipletypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedMap](#notmultipletypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [NotMultipleTypes1BoxedList](#notmultipletypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [NotMultipleTypes1Boxed](#notmultipletypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## NotBoxed +sealed interface NotBoxed
+permits
+[NotBoxedNumber](#notboxednumber), +[NotBoxedBoolean](#notboxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## NotBoxedNumber +data class NotBoxedNumber
+implements [NotBoxed](#notboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NotBoxedBoolean +data class NotBoxedBoolean
+implements [NotBoxed](#notboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NotBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Not +class Not
+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.NotMultipleTypes; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = NotMultipleTypes.Not.validate( + 1L, + configuration +); + +// boolean validation +boolean validatedPayload = NotMultipleTypes.Not.validate( + true, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java,
    Boolean::class.java
)
| +| String | type = "int"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [NotBoxedNumber](#notboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [NotBoxedBoolean](#notboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [NotBoxed](#notboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md new file mode 100644 index 00000000000..3fa79cb0018 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NulCharactersInStrings.md @@ -0,0 +1,98 @@ +# NulCharactersInStrings +org.openapijsonschematools.client.components.schemas.NulCharactersInStrings.java +class NulCharactersInStrings
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NulCharactersInStrings.NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed)
sealed interface for validated payloads | +| record | [NulCharactersInStrings.NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring)
boxed class to store validated String payloads | +| static class | [NulCharactersInStrings.NulCharactersInStrings1](#nulcharactersinstrings1)
schema class | +| enum | [NulCharactersInStrings.StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums)
String enum | + +## NulCharactersInStrings1Boxed +sealed interface NulCharactersInStrings1Boxed
+permits
+[NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## NulCharactersInStrings1BoxedString +data class NulCharactersInStrings1BoxedString
+implements [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NulCharactersInStrings1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## NulCharactersInStrings1 +class NulCharactersInStrings1
+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.NulCharactersInStrings; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = NulCharactersInStrings.NulCharactersInStrings1.validate( + "hello\u0000there", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Set | enumValues = setOf(
    "hello\u0000there"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| String | validate(arg: [StringNulCharactersInStringsEnums](#stringnulcharactersinstringsenums), configuration: SchemaConfiguration) | +| [NulCharactersInStrings1BoxedString](#nulcharactersinstrings1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [NulCharactersInStrings1Boxed](#nulcharactersinstrings1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## StringNulCharactersInStringsEnums +public enum StringNulCharactersInStringsEnums
+extends `Enum` + +A class that stores String enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| HELLO_NULL_THERE | value = "hello\u0000there" | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md new file mode 100644 index 00000000000..0bcdf2e30e4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NullTypeMatchesOnlyTheNullObject.md @@ -0,0 +1,52 @@ +# NullTypeMatchesOnlyTheNullObject +org.openapijsonschematools.client.components.schemas.NullTypeMatchesOnlyTheNullObject.java +class NullTypeMatchesOnlyTheNullObject
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed)
sealed interface for validated payloads | +| record | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid)
boxed class to store validated null payloads | +| static class | [NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1](#nulltypematchesonlythenullobject1)
schema class | + +## NullTypeMatchesOnlyTheNullObject1Boxed +sealed interface NullTypeMatchesOnlyTheNullObject1Boxed
+permits
+[NullTypeMatchesOnlyTheNullObject1BoxedVoid](#nulltypematchesonlythenullobject1boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## NullTypeMatchesOnlyTheNullObject1BoxedVoid +data class NullTypeMatchesOnlyTheNullObject1BoxedVoid
+implements [NullTypeMatchesOnlyTheNullObject1Boxed](#nulltypematchesonlythenullobject1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NullTypeMatchesOnlyTheNullObject1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## NullTypeMatchesOnlyTheNullObject1 +class NullTypeMatchesOnlyTheNullObject1
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md new file mode 100644 index 00000000000..02a48980434 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/NumberTypeMatchesNumbers.md @@ -0,0 +1,52 @@ +# NumberTypeMatchesNumbers +org.openapijsonschematools.client.components.schemas.NumberTypeMatchesNumbers.java +class NumberTypeMatchesNumbers
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed)
sealed interface for validated payloads | +| record | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber)
boxed class to store validated Number payloads | +| static class | [NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1](#numbertypematchesnumbers1)
schema class | + +## NumberTypeMatchesNumbers1Boxed +sealed interface NumberTypeMatchesNumbers1Boxed
+permits
+[NumberTypeMatchesNumbers1BoxedNumber](#numbertypematchesnumbers1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## NumberTypeMatchesNumbers1BoxedNumber +data class NumberTypeMatchesNumbers1BoxedNumber
+implements [NumberTypeMatchesNumbers1Boxed](#numbertypematchesnumbers1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| NumberTypeMatchesNumbers1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## NumberTypeMatchesNumbers1 +class NumberTypeMatchesNumbers1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md new file mode 100644 index 00000000000..a80a93be1e8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectPropertiesValidation.md @@ -0,0 +1,293 @@ +# ObjectPropertiesValidation +org.openapijsonschematools.client.components.schemas.ObjectPropertiesValidation.java +class ObjectPropertiesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [ObjectPropertiesValidation.ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [ObjectPropertiesValidation.ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidation1](#objectpropertiesvalidation1)
schema class | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder)
builder for Map payloads | +| static class | [ObjectPropertiesValidation.ObjectPropertiesValidationMap](#objectpropertiesvalidationmap)
output class for Map payloads | +| sealed interface | [ObjectPropertiesValidation.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| static class | [ObjectPropertiesValidation.Bar](#bar)
schema class | +| sealed interface | [ObjectPropertiesValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [ObjectPropertiesValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| static class | [ObjectPropertiesValidation.Foo](#foo)
schema class | + +## ObjectPropertiesValidation1Boxed +sealed interface ObjectPropertiesValidation1Boxed
+permits
+[ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid), +[ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean), +[ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber), +[ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring), +[ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist), +[ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectPropertiesValidation1BoxedVoid +data class ObjectPropertiesValidation1BoxedVoid
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedBoolean +data class ObjectPropertiesValidation1BoxedBoolean
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedNumber +data class ObjectPropertiesValidation1BoxedNumber
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedString +data class ObjectPropertiesValidation1BoxedString
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedList +data class ObjectPropertiesValidation1BoxedList
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1BoxedMap +data class ObjectPropertiesValidation1BoxedMap
+implements [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidation1BoxedMap([ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectPropertiesValidation1 +class ObjectPropertiesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | validate(arg: [Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedString](#objectpropertiesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedVoid](#objectpropertiesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedNumber](#objectpropertiesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedBoolean](#objectpropertiesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedMap](#objectpropertiesvalidation1boxedmap) | validateAndBox([Map<?, ?>](#objectpropertiesvalidationmapbuilder), configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1BoxedList](#objectpropertiesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ObjectPropertiesValidation1Boxed](#objectpropertiesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ObjectPropertiesValidationMapBuilder +class ObjectPropertiesValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectPropertiesValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | foo(value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | bar(value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [ObjectPropertiesValidationMapBuilder](#objectpropertiesvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## ObjectPropertiesValidationMap +class ObjectPropertiesValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ObjectPropertiesValidationMap](#objectpropertiesvalidationmap) | of([Map](#objectpropertiesvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Number | foo()
[optional] | +| String | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedString](#barboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedNumber](#fooboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md new file mode 100644 index 00000000000..ddc0d8b8aa6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ObjectTypeMatchesObjects.md @@ -0,0 +1,52 @@ +# ObjectTypeMatchesObjects +org.openapijsonschematools.client.components.schemas.ObjectTypeMatchesObjects.java +class ObjectTypeMatchesObjects
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed)
sealed interface for validated payloads | +| record | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap)
boxed class to store validated Map payloads | +| static class | [ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1](#objecttypematchesobjects1)
schema class | + +## ObjectTypeMatchesObjects1Boxed +sealed interface ObjectTypeMatchesObjects1Boxed
+permits
+[ObjectTypeMatchesObjects1BoxedMap](#objecttypematchesobjects1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ObjectTypeMatchesObjects1BoxedMap +data class ObjectTypeMatchesObjects1BoxedMap
+implements [ObjectTypeMatchesObjects1Boxed](#objecttypematchesobjects1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ObjectTypeMatchesObjects1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ObjectTypeMatchesObjects1 +class ObjectTypeMatchesObjects1
+extends MapJsonSchema.MapJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Oneof.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Oneof.md new file mode 100644 index 00000000000..c94e5017546 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/Oneof.md @@ -0,0 +1,362 @@ +# Oneof +org.openapijsonschematools.client.components.schemas.Oneof.java +class Oneof
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [Oneof.Oneof1Boxed](#oneof1boxed)
sealed interface for validated payloads | +| record | [Oneof.Oneof1BoxedVoid](#oneof1boxedvoid)
boxed class to store validated null payloads | +| record | [Oneof.Oneof1BoxedBoolean](#oneof1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Oneof.Oneof1BoxedNumber](#oneof1boxednumber)
boxed class to store validated Number payloads | +| record | [Oneof.Oneof1BoxedString](#oneof1boxedstring)
boxed class to store validated String payloads | +| record | [Oneof.Oneof1BoxedList](#oneof1boxedlist)
boxed class to store validated List payloads | +| record | [Oneof.Oneof1BoxedMap](#oneof1boxedmap)
boxed class to store validated Map payloads | +| static class | [Oneof.Oneof1](#oneof1)
schema class | +| sealed interface | [Oneof.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [Oneof.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [Oneof.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [Oneof.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [Oneof.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [Oneof.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [Oneof.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [Oneof.Schema1](#schema1)
schema class | +| sealed interface | [Oneof.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [Oneof.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [Oneof.Schema0](#schema0)
schema class | + +## Oneof1Boxed +sealed interface Oneof1Boxed
+permits
+[Oneof1BoxedVoid](#oneof1boxedvoid), +[Oneof1BoxedBoolean](#oneof1boxedboolean), +[Oneof1BoxedNumber](#oneof1boxednumber), +[Oneof1BoxedString](#oneof1boxedstring), +[Oneof1BoxedList](#oneof1boxedlist), +[Oneof1BoxedMap](#oneof1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Oneof1BoxedVoid +data class Oneof1BoxedVoid
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedBoolean +data class Oneof1BoxedBoolean
+implements [Oneof1Boxed](#oneof1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedNumber +data class Oneof1BoxedNumber
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedString +data class Oneof1BoxedString
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedList +data class Oneof1BoxedList
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1BoxedMap +data class Oneof1BoxedMap
+implements [Oneof1Boxed](#oneof1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Oneof1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Oneof1 +class Oneof1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Oneof1BoxedString](#oneof1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Oneof1BoxedVoid](#oneof1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Oneof1BoxedNumber](#oneof1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Oneof1BoxedBoolean](#oneof1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Oneof1BoxedMap](#oneof1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Oneof1BoxedList](#oneof1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Oneof1Boxed](#oneof1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md new file mode 100644 index 00000000000..42bf6a2067a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofComplexTypes.md @@ -0,0 +1,674 @@ +# OneofComplexTypes +org.openapijsonschematools.client.components.schemas.OneofComplexTypes.java +class OneofComplexTypes
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [OneofComplexTypes.OneofComplexTypes1Boxed](#oneofcomplextypes1boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.OneofComplexTypes1](#oneofcomplextypes1)
schema class | +| sealed interface | [OneofComplexTypes.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema1](#schema1)
schema class | +| static class | [OneofComplexTypes.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [OneofComplexTypes.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [OneofComplexTypes.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [OneofComplexTypes.Foo](#foo)
schema class | +| sealed interface | [OneofComplexTypes.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofComplexTypes.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofComplexTypes.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofComplexTypes.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofComplexTypes.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofComplexTypes.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofComplexTypes.Schema0](#schema0)
schema class | +| static class | [OneofComplexTypes.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [OneofComplexTypes.Schema0Map](#schema0map)
output class for Map payloads | +| sealed interface | [OneofComplexTypes.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [OneofComplexTypes.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| static class | [OneofComplexTypes.Bar](#bar)
schema class | + +## OneofComplexTypes1Boxed +sealed interface OneofComplexTypes1Boxed
+permits
+[OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid), +[OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean), +[OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber), +[OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring), +[OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist), +[OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofComplexTypes1BoxedVoid +data class OneofComplexTypes1BoxedVoid
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedBoolean +data class OneofComplexTypes1BoxedBoolean
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedNumber +data class OneofComplexTypes1BoxedNumber
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedString +data class OneofComplexTypes1BoxedString
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedList +data class OneofComplexTypes1BoxedList
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1BoxedMap +data class OneofComplexTypes1BoxedMap
+implements [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofComplexTypes1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofComplexTypes1 +class OneofComplexTypes1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedString](#oneofcomplextypes1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedVoid](#oneofcomplextypes1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedNumber](#oneofcomplextypes1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedBoolean](#oneofcomplextypes1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedMap](#oneofcomplextypes1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1BoxedList](#oneofcomplextypes1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofComplexTypes1Boxed](#oneofcomplextypes1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map0Builder +class Schema1Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: String) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: List) | +| [Schema1Map0Builder](#schema1map0builder) | additionalProperty(key: String, value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map0Builder](#schema1map0builder) | foo(value: String) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map0Builder +class Schema0Map0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: String) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: List) | +| [Schema0Map0Builder](#schema0map0builder) | additionalProperty(key: String, value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Int) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Float) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Long) | +| [Schema0Map0Builder](#schema0map0builder) | bar(value: Double) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Number | bar()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedNumber](#barboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md new file mode 100644 index 00000000000..ec2efa5bd7a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithBaseSchema.md @@ -0,0 +1,394 @@ +# OneofWithBaseSchema +org.openapijsonschematools.client.components.schemas.OneofWithBaseSchema.java +class OneofWithBaseSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithBaseSchema.OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring)
boxed class to store validated String payloads | +| static class | [OneofWithBaseSchema.OneofWithBaseSchema1](#oneofwithbaseschema1)
schema class | +| sealed interface | [OneofWithBaseSchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema1](#schema1)
schema class | +| sealed interface | [OneofWithBaseSchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithBaseSchema.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithBaseSchema.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithBaseSchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithBaseSchema.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithBaseSchema.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithBaseSchema.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithBaseSchema.Schema0](#schema0)
schema class | + +## OneofWithBaseSchema1Boxed +sealed interface OneofWithBaseSchema1Boxed
+permits
+[OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithBaseSchema1BoxedString +data class OneofWithBaseSchema1BoxedString
+implements [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithBaseSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithBaseSchema1 +class OneofWithBaseSchema1
+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.OneofWithBaseSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = OneofWithBaseSchema.OneofWithBaseSchema1.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1BoxedString](#oneofwithbaseschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithBaseSchema1Boxed](#oneofwithbaseschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | maxLength = 4 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minLength = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md new file mode 100644 index 00000000000..3c41a98cb37 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithEmptySchema.md @@ -0,0 +1,340 @@ +# OneofWithEmptySchema +org.openapijsonschematools.client.components.schemas.OneofWithEmptySchema.java +class OneofWithEmptySchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [OneofWithEmptySchema.OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.OneofWithEmptySchema1](#oneofwithemptyschema1)
schema class | +| sealed interface | [OneofWithEmptySchema.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithEmptySchema.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithEmptySchema.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithEmptySchema.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithEmptySchema.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithEmptySchema.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithEmptySchema.Schema1](#schema1)
schema class | +| sealed interface | [OneofWithEmptySchema.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithEmptySchema.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| static class | [OneofWithEmptySchema.Schema0](#schema0)
schema class | + +## OneofWithEmptySchema1Boxed +sealed interface OneofWithEmptySchema1Boxed
+permits
+[OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid), +[OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean), +[OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber), +[OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring), +[OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist), +[OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithEmptySchema1BoxedVoid +data class OneofWithEmptySchema1BoxedVoid
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedBoolean +data class OneofWithEmptySchema1BoxedBoolean
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedNumber +data class OneofWithEmptySchema1BoxedNumber
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedString +data class OneofWithEmptySchema1BoxedString
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedList +data class OneofWithEmptySchema1BoxedList
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1BoxedMap +data class OneofWithEmptySchema1BoxedMap
+implements [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithEmptySchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithEmptySchema1 +class OneofWithEmptySchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedString](#oneofwithemptyschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedVoid](#oneofwithemptyschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedNumber](#oneofwithemptyschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedBoolean](#oneofwithemptyschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedMap](#oneofwithemptyschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1BoxedList](#oneofwithemptyschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [OneofWithEmptySchema1Boxed](#oneofwithemptyschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedNumber](#schema0boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md new file mode 100644 index 00000000000..5fb44f316d2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/OneofWithRequired.md @@ -0,0 +1,617 @@ +# OneofWithRequired +org.openapijsonschematools.client.components.schemas.OneofWithRequired.java +class OneofWithRequired
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [OneofWithRequired.OneofWithRequired1Boxed](#oneofwithrequired1boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.OneofWithRequired1](#oneofwithrequired1)
schema class | +| sealed interface | [OneofWithRequired.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema1](#schema1)
schema class | +| static class | [OneofWithRequired.Schema1MapBuilder](#schema1mapbuilder)
builder for Map payloads | +| static class | [OneofWithRequired.Schema1Map](#schema1map)
output class for Map payloads | +| sealed interface | [OneofWithRequired.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [OneofWithRequired.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [OneofWithRequired.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [OneofWithRequired.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [OneofWithRequired.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [OneofWithRequired.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [OneofWithRequired.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [OneofWithRequired.Schema0](#schema0)
schema class | +| static class | [OneofWithRequired.Schema0MapBuilder](#schema0mapbuilder)
builder for Map payloads | +| static class | [OneofWithRequired.Schema0Map](#schema0map)
output class for Map payloads | + +## OneofWithRequired1Boxed +sealed interface OneofWithRequired1Boxed
+permits
+[OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## OneofWithRequired1BoxedMap +data class OneofWithRequired1BoxedMap
+implements [OneofWithRequired1Boxed](#oneofwithrequired1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| OneofWithRequired1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## OneofWithRequired1 +class OneofWithRequired1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| List> | oneOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
))
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1BoxedMap](#oneofwithrequired1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [OneofWithRequired1Boxed](#oneofwithrequired1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap([Schema1Map](#schema1map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map](#schema1map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "baz",
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema1Map](#schema1map) | validate(arg: [Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox([Map<?, ?>](#schema1mapbuilder), configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Map00Builder +class Schema1Map00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map00Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: String) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: List) | +| [Schema1Map00Builder](#schema1map00builder) | additionalProperty(key: String, value: Map) | + +## Schema1Map01Builder +class Schema1Map01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | foo(value: Map) | + +## Schema1Map10Builder +class Schema1Map10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1Map10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Nothing?) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Boolean) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: String) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Int) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Float) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Long) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Double) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: List) | +| [Schema1Map00Builder](#schema1map00builder) | baz(value: Map) | + +## Schema1MapBuilder +class Schema1MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Nothing?) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Boolean) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: String) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Int) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Float) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Long) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Double) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: List) | +| [Schema1Map01Builder](#schema1map01builder) | baz(value: Map) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Nothing?) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Boolean) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: String) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Int) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Float) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Long) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Double) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: List) | +| [Schema1Map10Builder](#schema1map10builder) | foo(value: Map) | + +## Schema1Map +class Schema1Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema1Map](#schema1map) | of([Map](#schema1mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | baz()
| +| Any? | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap([Schema0Map](#schema0map) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map](#schema0map) | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "bar",
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [Schema0Map](#schema0map) | validate(arg: [Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox([Map<?, ?>](#schema0mapbuilder), configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Map00Builder +class Schema0Map00Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map00Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: String) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: List) | +| [Schema0Map00Builder](#schema0map00builder) | additionalProperty(key: String, value: Map) | + +## Schema0Map01Builder +class Schema0Map01Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map01Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | foo(value: Map) | + +## Schema0Map10Builder +class Schema0Map10Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0Map10Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Nothing?) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Boolean) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: String) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Int) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Float) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Long) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Double) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: List) | +| [Schema0Map00Builder](#schema0map00builder) | bar(value: Map) | + +## Schema0MapBuilder +class Schema0MapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0MapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Nothing?) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Boolean) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: String) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Int) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Float) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Long) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Double) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: List) | +| [Schema0Map01Builder](#schema0map01builder) | bar(value: Map) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Nothing?) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Boolean) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: String) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Int) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Float) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Long) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Double) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: List) | +| [Schema0Map10Builder](#schema0map10builder) | foo(value: Map) | + +## Schema0Map +class Schema0Map
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [Schema0Map](#schema0map) | of([Map](#schema0mapbuilder) arg, SchemaConfiguration configuration) | +| Any? | bar()
| +| Any? | foo()
| +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md new file mode 100644 index 00000000000..db50b22bddc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternIsNotAnchored.md @@ -0,0 +1,169 @@ +# PatternIsNotAnchored +org.openapijsonschematools.client.components.schemas.PatternIsNotAnchored.java +class PatternIsNotAnchored
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternIsNotAnchored.PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed)
sealed interface for validated payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring)
boxed class to store validated String payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist)
boxed class to store validated List payloads | +| record | [PatternIsNotAnchored.PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternIsNotAnchored.PatternIsNotAnchored1](#patternisnotanchored1)
schema class | + +## PatternIsNotAnchored1Boxed +sealed interface PatternIsNotAnchored1Boxed
+permits
+[PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid), +[PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean), +[PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber), +[PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring), +[PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist), +[PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternIsNotAnchored1BoxedVoid +data class PatternIsNotAnchored1BoxedVoid
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedBoolean +data class PatternIsNotAnchored1BoxedBoolean
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedNumber +data class PatternIsNotAnchored1BoxedNumber
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedString +data class PatternIsNotAnchored1BoxedString
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedList +data class PatternIsNotAnchored1BoxedList
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1BoxedMap +data class PatternIsNotAnchored1BoxedMap
+implements [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternIsNotAnchored1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternIsNotAnchored1 +class PatternIsNotAnchored1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
    "a+"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedString](#patternisnotanchored1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedVoid](#patternisnotanchored1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedNumber](#patternisnotanchored1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedBoolean](#patternisnotanchored1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedMap](#patternisnotanchored1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1BoxedList](#patternisnotanchored1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternIsNotAnchored1Boxed](#patternisnotanchored1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternValidation.md new file mode 100644 index 00000000000..38aabdd0f51 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternValidation.md @@ -0,0 +1,169 @@ +# PatternValidation +org.openapijsonschematools.client.components.schemas.PatternValidation.java +class PatternValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternValidation.PatternValidation1Boxed](#patternvalidation1boxed)
sealed interface for validated payloads | +| record | [PatternValidation.PatternValidation1BoxedVoid](#patternvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternValidation.PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternValidation.PatternValidation1BoxedNumber](#patternvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternValidation.PatternValidation1BoxedString](#patternvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [PatternValidation.PatternValidation1BoxedList](#patternvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [PatternValidation.PatternValidation1BoxedMap](#patternvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternValidation.PatternValidation1](#patternvalidation1)
schema class | + +## PatternValidation1Boxed +sealed interface PatternValidation1Boxed
+permits
+[PatternValidation1BoxedVoid](#patternvalidation1boxedvoid), +[PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean), +[PatternValidation1BoxedNumber](#patternvalidation1boxednumber), +[PatternValidation1BoxedString](#patternvalidation1boxedstring), +[PatternValidation1BoxedList](#patternvalidation1boxedlist), +[PatternValidation1BoxedMap](#patternvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternValidation1BoxedVoid +data class PatternValidation1BoxedVoid
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedBoolean +data class PatternValidation1BoxedBoolean
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedNumber +data class PatternValidation1BoxedNumber
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedString +data class PatternValidation1BoxedString
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedList +data class PatternValidation1BoxedList
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1BoxedMap +data class PatternValidation1BoxedMap
+implements [PatternValidation1Boxed](#patternvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternValidation1 +class PatternValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Pattern | pattern = Pattern.compile(
    "^a*\$"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedString](#patternvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedVoid](#patternvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedNumber](#patternvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedBoolean](#patternvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedMap](#patternvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternValidation1BoxedList](#patternvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternValidation1Boxed](#patternvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md new file mode 100644 index 00000000000..4699b05b70e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.md @@ -0,0 +1,207 @@ +# PatternpropertiesValidatesPropertiesMatchingARegex +org.openapijsonschematools.client.components.schemas.PatternpropertiesValidatesPropertiesMatchingARegex.java +class PatternpropertiesValidatesPropertiesMatchingARegex
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed)
sealed interface for validated payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid](#patternpropertiesvalidatespropertiesmatchingaregex1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean](#patternpropertiesvalidatespropertiesmatchingaregex1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber](#patternpropertiesvalidatespropertiesmatchingaregex1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString](#patternpropertiesvalidatespropertiesmatchingaregex1boxedstring)
boxed class to store validated String payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList](#patternpropertiesvalidatespropertiesmatchingaregex1boxedlist)
boxed class to store validated List payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap](#patternpropertiesvalidatespropertiesmatchingaregex1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1](#patternpropertiesvalidatespropertiesmatchingaregex1)
schema class | +| sealed interface | [PatternpropertiesValidatesPropertiesMatchingARegex.FoBoxed](#foboxed)
sealed interface for validated payloads | +| record | [PatternpropertiesValidatesPropertiesMatchingARegex.FoBoxedNumber](#foboxednumber)
boxed class to store validated Number payloads | +| static class | [PatternpropertiesValidatesPropertiesMatchingARegex.Fo](#fo)
schema class | + +## PatternpropertiesValidatesPropertiesMatchingARegex1Boxed +sealed interface PatternpropertiesValidatesPropertiesMatchingARegex1Boxed
+permits
+[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid](#patternpropertiesvalidatespropertiesmatchingaregex1boxedvoid), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean](#patternpropertiesvalidatespropertiesmatchingaregex1boxedboolean), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber](#patternpropertiesvalidatespropertiesmatchingaregex1boxednumber), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString](#patternpropertiesvalidatespropertiesmatchingaregex1boxedstring), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList](#patternpropertiesvalidatespropertiesmatchingaregex1boxedlist), +[PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap](#patternpropertiesvalidatespropertiesmatchingaregex1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid
+implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean
+implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber
+implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString
+implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList
+implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap +data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap
+implements [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesValidatesPropertiesMatchingARegex1 +class PatternpropertiesValidatesPropertiesMatchingARegex1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
    Pattern.compile("f.*o") to [Fo::class.java](#fo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString](#patternpropertiesvalidatespropertiesmatchingaregex1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid](#patternpropertiesvalidatespropertiesmatchingaregex1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber](#patternpropertiesvalidatespropertiesmatchingaregex1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean](#patternpropertiesvalidatespropertiesmatchingaregex1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap](#patternpropertiesvalidatespropertiesmatchingaregex1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList](#patternpropertiesvalidatespropertiesmatchingaregex1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesValidatesPropertiesMatchingARegex1Boxed](#patternpropertiesvalidatespropertiesmatchingaregex1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoBoxed +sealed interface FoBoxed
+permits
+[FoBoxedNumber](#foboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoBoxedNumber +data class FoBoxedNumber
+implements [FoBoxed](#foboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Fo +class Fo
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..08959f1f8a6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,207 @@ +# PatternpropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.PatternpropertiesWithNullValuedInstanceProperties.java +class PatternpropertiesWithNullValuedInstanceProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed)
sealed interface for validated payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid](#patternpropertieswithnullvaluedinstanceproperties1boxedvoid)
boxed class to store validated null payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#patternpropertieswithnullvaluedinstanceproperties1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber](#patternpropertieswithnullvaluedinstanceproperties1boxednumber)
boxed class to store validated Number payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedString](#patternpropertieswithnullvaluedinstanceproperties1boxedstring)
boxed class to store validated String payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedList](#patternpropertieswithnullvaluedinstanceproperties1boxedlist)
boxed class to store validated List payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1BoxedMap](#patternpropertieswithnullvaluedinstanceproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1](#patternpropertieswithnullvaluedinstanceproperties1)
schema class | +| sealed interface | [PatternpropertiesWithNullValuedInstanceProperties.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [PatternpropertiesWithNullValuedInstanceProperties.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| static class | [PatternpropertiesWithNullValuedInstanceProperties.Bar](#bar)
schema class | + +## PatternpropertiesWithNullValuedInstanceProperties1Boxed +sealed interface PatternpropertiesWithNullValuedInstanceProperties1Boxed
+permits
+[PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid](#patternpropertieswithnullvaluedinstanceproperties1boxedvoid), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#patternpropertieswithnullvaluedinstanceproperties1boxedboolean), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber](#patternpropertieswithnullvaluedinstanceproperties1boxednumber), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedString](#patternpropertieswithnullvaluedinstanceproperties1boxedstring), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedList](#patternpropertieswithnullvaluedinstanceproperties1boxedlist), +[PatternpropertiesWithNullValuedInstanceProperties1BoxedMap](#patternpropertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid
+implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean
+implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber
+implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedString +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedString
+implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedList +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedList
+implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1BoxedMap +data class PatternpropertiesWithNullValuedInstanceProperties1BoxedMap
+implements [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PatternpropertiesWithNullValuedInstanceProperties1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PatternpropertiesWithNullValuedInstanceProperties1 +class PatternpropertiesWithNullValuedInstanceProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
    Pattern.compile("^.*bar\$") to [Bar::class.java](#bar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedString](#patternpropertieswithnullvaluedinstanceproperties1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid](#patternpropertieswithnullvaluedinstanceproperties1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber](#patternpropertieswithnullvaluedinstanceproperties1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#patternpropertieswithnullvaluedinstanceproperties1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedMap](#patternpropertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1BoxedList](#patternpropertieswithnullvaluedinstanceproperties1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PatternpropertiesWithNullValuedInstanceProperties1Boxed](#patternpropertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md new file mode 100644 index 00000000000..7bef5b19137 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.md @@ -0,0 +1,202 @@ +# PrefixitemsValidationAdjustsTheStartingIndexForItems +org.openapijsonschematools.client.components.schemas.PrefixitemsValidationAdjustsTheStartingIndexForItems.java +class PrefixitemsValidationAdjustsTheStartingIndexForItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed](#prefixitemsvalidationadjuststhestartingindexforitems1boxed)
sealed interface for validated payloads | +| record | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList](#prefixitemsvalidationadjuststhestartingindexforitems1boxedlist)
boxed class to store validated List payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1](#prefixitemsvalidationadjuststhestartingindexforitems1)
schema class | +| sealed interface | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Schema0](#schema0)
schema class | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder)
builder for List payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist)
output class for List payloads | +| sealed interface | [PrefixitemsValidationAdjustsTheStartingIndexForItems.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [PrefixitemsValidationAdjustsTheStartingIndexForItems.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| static class | [PrefixitemsValidationAdjustsTheStartingIndexForItems.Items](#items)
schema class | + +## PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed +sealed interface PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed
+permits
+[PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList](#prefixitemsvalidationadjuststhestartingindexforitems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList +data class PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList
+implements [PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed](#prefixitemsvalidationadjuststhestartingindexforitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList([PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## PrefixitemsValidationAdjustsTheStartingIndexForItems1 +class PrefixitemsValidationAdjustsTheStartingIndexForItems1
+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.PrefixitemsValidationAdjustsTheStartingIndexForItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsList validatedPayload = + PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1.validate( + new PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | +| List> | prefixItems = listOf(
    [Schema0::class.java](#schema0)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) | validate(arg: [List<*>](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList](#prefixitemsvalidationadjuststhestartingindexforitems1boxedlist) | validateAndBox([List<*>](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed](#prefixitemsvalidationadjuststhestartingindexforitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedString](#schema0boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder +class PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder()
Creates an empty list | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Int) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Float) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Long) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: Double) | +| PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder | add(item: String) | +| List | build()
Returns list input that should be used with Schema.validate | + +## PrefixitemsValidationAdjustsTheStartingIndexForItemsList +class PrefixitemsValidationAdjustsTheStartingIndexForItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PrefixitemsValidationAdjustsTheStartingIndexForItemsList](#prefixitemsvalidationadjuststhestartingindexforitemslist) | of([List](#prefixitemsvalidationadjuststhestartingindexforitemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedNumber](#itemsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedNumber +data class ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## Items +class Items
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsWithNullInstanceElements.md new file mode 100644 index 00000000000..c549c837813 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PrefixitemsWithNullInstanceElements.md @@ -0,0 +1,248 @@ +# PrefixitemsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.PrefixitemsWithNullInstanceElements.java +class PrefixitemsWithNullInstanceElements
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed)
sealed interface for validated payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedVoid](#prefixitemswithnullinstanceelements1boxedvoid)
boxed class to store validated null payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedBoolean](#prefixitemswithnullinstanceelements1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedNumber](#prefixitemswithnullinstanceelements1boxednumber)
boxed class to store validated Number payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedString](#prefixitemswithnullinstanceelements1boxedstring)
boxed class to store validated String payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedList](#prefixitemswithnullinstanceelements1boxedlist)
boxed class to store validated List payloads | +| record | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1BoxedMap](#prefixitemswithnullinstanceelements1boxedmap)
boxed class to store validated Map payloads | +| static class | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1](#prefixitemswithnullinstanceelements1)
schema class | +| sealed interface | [PrefixitemsWithNullInstanceElements.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [PrefixitemsWithNullInstanceElements.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| static class | [PrefixitemsWithNullInstanceElements.Schema0](#schema0)
schema class | +| static class | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElementsListBuilder](#prefixitemswithnullinstanceelementslistbuilder)
builder for List payloads | +| static class | [PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist)
output class for List payloads | + +## PrefixitemsWithNullInstanceElements1Boxed +sealed interface PrefixitemsWithNullInstanceElements1Boxed
+permits
+[PrefixitemsWithNullInstanceElements1BoxedVoid](#prefixitemswithnullinstanceelements1boxedvoid), +[PrefixitemsWithNullInstanceElements1BoxedBoolean](#prefixitemswithnullinstanceelements1boxedboolean), +[PrefixitemsWithNullInstanceElements1BoxedNumber](#prefixitemswithnullinstanceelements1boxednumber), +[PrefixitemsWithNullInstanceElements1BoxedString](#prefixitemswithnullinstanceelements1boxedstring), +[PrefixitemsWithNullInstanceElements1BoxedList](#prefixitemswithnullinstanceelements1boxedlist), +[PrefixitemsWithNullInstanceElements1BoxedMap](#prefixitemswithnullinstanceelements1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PrefixitemsWithNullInstanceElements1BoxedVoid +data class PrefixitemsWithNullInstanceElements1BoxedVoid
+implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedBoolean +data class PrefixitemsWithNullInstanceElements1BoxedBoolean
+implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedNumber +data class PrefixitemsWithNullInstanceElements1BoxedNumber
+implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedString +data class PrefixitemsWithNullInstanceElements1BoxedString
+implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedList +data class PrefixitemsWithNullInstanceElements1BoxedList
+implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedList([PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## PrefixitemsWithNullInstanceElements1BoxedMap +data class PrefixitemsWithNullInstanceElements1BoxedMap
+implements [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElements1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PrefixitemsWithNullInstanceElements1 +class PrefixitemsWithNullInstanceElements1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | prefixItems = listOf(
    [Schema0::class.java](#schema0)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) | validate(arg: [List<*>](#prefixitemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedString](#prefixitemswithnullinstanceelements1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedVoid](#prefixitemswithnullinstanceelements1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedNumber](#prefixitemswithnullinstanceelements1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedBoolean](#prefixitemswithnullinstanceelements1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedMap](#prefixitemswithnullinstanceelements1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1BoxedList](#prefixitemswithnullinstanceelements1boxedlist) | validateAndBox([List<*>](#prefixitemswithnullinstanceelementslistbuilder), configuration: SchemaConfiguration) | +| [PrefixitemsWithNullInstanceElements1Boxed](#prefixitemswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PrefixitemsWithNullInstanceElementsListBuilder +class PrefixitemsWithNullInstanceElementsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PrefixitemsWithNullInstanceElementsListBuilder()
Creates an empty list | +| PrefixitemsWithNullInstanceElementsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Nothing?) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Boolean) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: String) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Int) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Float) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Long) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Double) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: List) | +| PrefixitemsWithNullInstanceElementsListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## PrefixitemsWithNullInstanceElementsList +class PrefixitemsWithNullInstanceElementsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PrefixitemsWithNullInstanceElementsList](#prefixitemswithnullinstanceelementslist) | of([List](#prefixitemswithnullinstanceelementslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md new file mode 100644 index 00000000000..70a77d46f18 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.md @@ -0,0 +1,408 @@ +# PropertiesPatternpropertiesAdditionalpropertiesInteraction +org.openapijsonschematools.client.components.schemas.PropertiesPatternpropertiesAdditionalpropertiesInteraction.java +class PropertiesPatternpropertiesAdditionalpropertiesInteraction
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed](#propertiespatternpropertiesadditionalpropertiesinteraction1boxed)
sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap](#propertiespatternpropertiesadditionalpropertiesinteraction1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1](#propertiespatternpropertiesadditionalpropertiesinteraction1)
schema class | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder)
builder for Map payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap)
output class for Map payloads | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.Bar](#bar)
schema class | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.Foo](#foo)
schema class | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxed](#foboxed)
sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedVoid](#foboxedvoid)
boxed class to store validated null payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedBoolean](#foboxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedNumber](#foboxednumber)
boxed class to store validated Number payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedString](#foboxedstring)
boxed class to store validated String payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedList](#foboxedlist)
boxed class to store validated List payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.FoBoxedMap](#foboxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.Fo](#fo)
schema class | +| sealed interface | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesPatternpropertiesAdditionalpropertiesInteraction.AdditionalProperties](#additionalproperties)
schema class | + +## PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed +sealed interface PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed
+permits
+[PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap](#propertiespatternpropertiesadditionalpropertiesinteraction1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap +data class PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap
+implements [PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed](#propertiespatternpropertiesadditionalpropertiesinteraction1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap([PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesPatternpropertiesAdditionalpropertiesInteraction1 +class PropertiesPatternpropertiesAdditionalpropertiesInteraction1
+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.PropertiesPatternpropertiesAdditionalpropertiesInteraction; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMap validatedPayload = + PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.validate( + new PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder() + .additionalProperty("someAdditionalProperty", 1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| Map> | patternProperties = mapOf(
    Pattern.compile("f.o") to [Fo::class.java](#fo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | validate(arg: [Map<?, ?>](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap](#propertiespatternpropertiesadditionalpropertiesinteraction1boxedmap) | validateAndBox([Map<?, ?>](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed](#propertiespatternpropertiesadditionalpropertiesinteraction1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder +class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | foo(value: List) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | bar(value: List) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) | additionalProperty(key: String, value: Double) | + +## PropertiesPatternpropertiesAdditionalpropertiesInteractionMap +class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesPatternpropertiesAdditionalpropertiesInteractionMap](#propertiespatternpropertiesadditionalpropertiesinteractionmap) | of([Map](#propertiespatternpropertiesadditionalpropertiesinteractionmapbuilder) arg, SchemaConfiguration configuration) | +| FrozenList | foo()
[optional] | +| FrozenList | bar()
[optional] | +| Number | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedList](#barboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends ListJsonSchema.ListJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.ListJsonSchema.ListJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedList](#fooboxedlist) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Integer | maxItems = 3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FooBoxedList](#fooboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FooBoxed](#fooboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## FoBoxed +sealed interface FoBoxed
+permits
+[FoBoxedVoid](#foboxedvoid), +[FoBoxedBoolean](#foboxedboolean), +[FoBoxedNumber](#foboxednumber), +[FoBoxedString](#foboxedstring), +[FoBoxedList](#foboxedlist), +[FoBoxedMap](#foboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FoBoxedVoid +data class FoBoxedVoid
+implements [FoBoxed](#foboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FoBoxedBoolean +data class FoBoxedBoolean
+implements [FoBoxed](#foboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FoBoxedNumber +data class FoBoxedNumber
+implements [FoBoxed](#foboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FoBoxedString +data class FoBoxedString
+implements [FoBoxed](#foboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FoBoxedList +data class FoBoxedList
+implements [FoBoxed](#foboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FoBoxedMap +data class FoBoxedMap
+implements [FoBoxed](#foboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Fo +class Fo
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Integer | minItems = 2 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [FoBoxedString](#foboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [FoBoxedVoid](#foboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [FoBoxedNumber](#foboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [FoBoxedBoolean](#foboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [FoBoxedMap](#foboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [FoBoxedList](#foboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [FoBoxed](#foboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends IntJsonSchema.IntJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema.IntJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md new file mode 100644 index 00000000000..0cb472ad7c2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.md @@ -0,0 +1,538 @@ +# PropertiesWhoseNamesAreJavascriptObjectPropertyNames +org.openapijsonschematools.client.components.schemas.PropertiesWhoseNamesAreJavascriptObjectPropertyNames.java +class PropertiesWhoseNamesAreJavascriptObjectPropertyNames
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed)
sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#propertieswhosenamesarejavascriptobjectpropertynames1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#propertieswhosenamesarejavascriptobjectpropertynames1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#propertieswhosenamesarejavascriptobjectpropertynames1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#propertieswhosenamesarejavascriptobjectpropertynames1boxedstring)
boxed class to store validated String payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#propertieswhosenamesarejavascriptobjectpropertynames1boxedlist)
boxed class to store validated List payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#propertieswhosenamesarejavascriptobjectpropertynames1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1](#propertieswhosenamesarejavascriptobjectpropertynames1)
schema class | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder)
builder for Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap)
output class for Map payloads | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchemaBoxed](#constructorschemaboxed)
sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchemaBoxedNumber](#constructorschemaboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ConstructorSchema](#constructorschema)
schema class | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxed](#tostringschemaboxed)
sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedVoid](#tostringschemaboxedvoid)
boxed class to store validated null payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedBoolean](#tostringschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedNumber](#tostringschemaboxednumber)
boxed class to store validated Number payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedString](#tostringschemaboxedstring)
boxed class to store validated String payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedList](#tostringschemaboxedlist)
boxed class to store validated List payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchemaBoxedMap](#tostringschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringSchema](#tostringschema)
schema class | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringMapBuilder](#tostringmapbuilder)
builder for Map payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ToStringMap](#tostringmap)
output class for Map payloads | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.LengthBoxed](#lengthboxed)
sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.LengthBoxedString](#lengthboxedstring)
boxed class to store validated String payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.Length](#length)
schema class | +| sealed interface | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ProtoBoxed](#protoboxed)
sealed interface for validated payloads | +| record | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.ProtoBoxedNumber](#protoboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWhoseNamesAreJavascriptObjectPropertyNames.Proto](#proto)
schema class | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed +sealed interface PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed
+permits
+[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#propertieswhosenamesarejavascriptobjectpropertynames1boxedvoid), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#propertieswhosenamesarejavascriptobjectpropertynames1boxedboolean), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#propertieswhosenamesarejavascriptobjectpropertynames1boxednumber), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#propertieswhosenamesarejavascriptobjectpropertynames1boxedstring), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#propertieswhosenamesarejavascriptobjectpropertynames1boxedlist), +[PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#propertieswhosenamesarejavascriptobjectpropertynames1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid
+implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean
+implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber
+implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString
+implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList
+implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap +data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap
+implements [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap([PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNames1 +class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "__proto__" to [Proto::class.java](#proto)),
    "toString" to [ToStringSchema::class.java](#tostringschema)),
    "constructor" to [ConstructorSchema::class.java](#constructorschema))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) | validate(arg: [Map<?, ?>](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#propertieswhosenamesarejavascriptobjectpropertynames1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#propertieswhosenamesarejavascriptobjectpropertynames1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#propertieswhosenamesarejavascriptobjectpropertynames1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#propertieswhosenamesarejavascriptobjectpropertynames1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#propertieswhosenamesarejavascriptobjectpropertynames1boxedmap) | validateAndBox([Map<?, ?>](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#propertieswhosenamesarejavascriptobjectpropertynames1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#propertieswhosenamesarejavascriptobjectpropertynames1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder +class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | lowLineProto(value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Nothing?) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Boolean) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: String) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: List) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | toString(value: Map) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | setConstructor(value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap +class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#propertieswhosenamesarejavascriptobjectpropertynamesmap) | of([Map](#propertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["toString"], instance["constructor"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## ConstructorSchemaBoxed +sealed interface ConstructorSchemaBoxed
+permits
+[ConstructorSchemaBoxedNumber](#constructorschemaboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ConstructorSchemaBoxedNumber +data class ConstructorSchemaBoxedNumber
+implements [ConstructorSchemaBoxed](#constructorschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ConstructorSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ConstructorSchema +class ConstructorSchema
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ToStringSchemaBoxed +sealed interface ToStringSchemaBoxed
+permits
+[ToStringSchemaBoxedVoid](#tostringschemaboxedvoid), +[ToStringSchemaBoxedBoolean](#tostringschemaboxedboolean), +[ToStringSchemaBoxedNumber](#tostringschemaboxednumber), +[ToStringSchemaBoxedString](#tostringschemaboxedstring), +[ToStringSchemaBoxedList](#tostringschemaboxedlist), +[ToStringSchemaBoxedMap](#tostringschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ToStringSchemaBoxedVoid +data class ToStringSchemaBoxedVoid
+implements [ToStringSchemaBoxed](#tostringschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ToStringSchemaBoxedBoolean +data class ToStringSchemaBoxedBoolean
+implements [ToStringSchemaBoxed](#tostringschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ToStringSchemaBoxedNumber +data class ToStringSchemaBoxedNumber
+implements [ToStringSchemaBoxed](#tostringschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ToStringSchemaBoxedString +data class ToStringSchemaBoxedString
+implements [ToStringSchemaBoxed](#tostringschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ToStringSchemaBoxedList +data class ToStringSchemaBoxedList
+implements [ToStringSchemaBoxed](#tostringschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ToStringSchemaBoxedMap +data class ToStringSchemaBoxedMap
+implements [ToStringSchemaBoxed](#tostringschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringSchemaBoxedMap([ToStringMap](#tostringmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [ToStringMap](#tostringmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## ToStringSchema +class ToStringSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "length" to [Length::class.java](#length))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [ToStringMap](#tostringmap) | validate(arg: [Map<?, ?>](#tostringmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedString](#tostringschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedVoid](#tostringschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedNumber](#tostringschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedBoolean](#tostringschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedMap](#tostringschemaboxedmap) | validateAndBox([Map<?, ?>](#tostringmapbuilder), configuration: SchemaConfiguration) | +| [ToStringSchemaBoxedList](#tostringschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ToStringSchemaBoxed](#tostringschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ToStringMapBuilder +class ToStringMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ToStringMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [ToStringMapBuilder](#tostringmapbuilder) | length(value: String) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: String) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Int) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Float) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Long) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Double) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: List) | +| [ToStringMapBuilder](#tostringmapbuilder) | additionalProperty(key: String, value: Map) | + +## ToStringMap +class ToStringMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [ToStringMap](#tostringmap) | of([Map](#tostringmapbuilder) arg, SchemaConfiguration configuration) | +| String | length()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## LengthBoxed +sealed interface LengthBoxed
+permits
+[LengthBoxedString](#lengthboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## LengthBoxedString +data class LengthBoxedString
+implements [LengthBoxed](#lengthboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| LengthBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Length +class Length
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## ProtoBoxed +sealed interface ProtoBoxed
+permits
+[ProtoBoxedNumber](#protoboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ProtoBoxedNumber +data class ProtoBoxedNumber
+implements [ProtoBoxed](#protoboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ProtoBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Proto +class Proto
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md new file mode 100644 index 00000000000..385cc3ca185 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithEscapedCharacters.md @@ -0,0 +1,463 @@ +# PropertiesWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.PropertiesWithEscapedCharacters.java +class PropertiesWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist)
boxed class to store validated List payloads | +| record | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1](#propertieswithescapedcharacters1)
schema class | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder)
builder for Map payloads | +| static class | [PropertiesWithEscapedCharacters.PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap)
output class for Map payloads | +| sealed interface | [PropertiesWithEscapedCharacters.Foou000CbarBoxed](#foou000cbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foou000CbarBoxedNumber](#foou000cbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foou000Cbar](#foou000cbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FootbarBoxed](#footbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FootbarBoxedNumber](#footbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Footbar](#footbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoorbarBoxed](#foorbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoorbarBoxedNumber](#foorbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foorbar](#foorbar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.Foobar1Boxed](#foobar1boxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.Foobar1BoxedNumber](#foobar1boxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar1](#foobar1)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoobarBoxed](#foobarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoobarBoxedNumber](#foobarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foobar](#foobar)
schema class | +| sealed interface | [PropertiesWithEscapedCharacters.FoonbarBoxed](#foonbarboxed)
sealed interface for validated payloads | +| record | [PropertiesWithEscapedCharacters.FoonbarBoxedNumber](#foonbarboxednumber)
boxed class to store validated Number payloads | +| static class | [PropertiesWithEscapedCharacters.Foonbar](#foonbar)
schema class | + +## PropertiesWithEscapedCharacters1Boxed +sealed interface PropertiesWithEscapedCharacters1Boxed
+permits
+[PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid), +[PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean), +[PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber), +[PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring), +[PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist), +[PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWithEscapedCharacters1BoxedVoid +data class PropertiesWithEscapedCharacters1BoxedVoid
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedBoolean +data class PropertiesWithEscapedCharacters1BoxedBoolean
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedNumber +data class PropertiesWithEscapedCharacters1BoxedNumber
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedString +data class PropertiesWithEscapedCharacters1BoxedString
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedList +data class PropertiesWithEscapedCharacters1BoxedList
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1BoxedMap +data class PropertiesWithEscapedCharacters1BoxedMap
+implements [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharacters1BoxedMap([PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithEscapedCharacters1 +class PropertiesWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo\nbar" to [Foonbar::class.java](#foonbar)),
    "foo\"bar" to [Foobar::class.java](#foobar)),
    "foo\\bar" to [Foobar1::class.java](#foobar1)),
    "foo\rbar" to [Foorbar::class.java](#foorbar)),
    "foo\tbar" to [Footbar::class.java](#footbar)),
    "foo\u000Cbar" to [Foou000Cbar::class.java](#foou000cbar))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | validate(arg: [Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedString](#propertieswithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedVoid](#propertieswithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedNumber](#propertieswithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedBoolean](#propertieswithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedMap](#propertieswithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#propertieswithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1BoxedList](#propertieswithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithEscapedCharacters1Boxed](#propertieswithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWithEscapedCharactersMapBuilder +class PropertiesWithEscapedCharactersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithEscapedCharactersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusNbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusRbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusTbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | fooReverseSolidusU000cbar(value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWithEscapedCharactersMapBuilder](#propertieswithescapedcharactersmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWithEscapedCharactersMap +class PropertiesWithEscapedCharactersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWithEscapedCharactersMap](#propertieswithescapedcharactersmap) | of([Map](#propertieswithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["foo\nbar"], instance["foo\"bar"], instance["foo\\bar"], instance["foo\rbar"], instance["foo\tbar"], instance["foo\u000Cbar"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## Foou000CbarBoxed +sealed interface Foou000CbarBoxed
+permits
+[Foou000CbarBoxedNumber](#foou000cbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foou000CbarBoxedNumber +data class Foou000CbarBoxedNumber
+implements [Foou000CbarBoxed](#foou000cbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foou000CbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foou000Cbar +class Foou000Cbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FootbarBoxed +sealed interface FootbarBoxed
+permits
+[FootbarBoxedNumber](#footbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FootbarBoxedNumber +data class FootbarBoxedNumber
+implements [FootbarBoxed](#footbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FootbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Footbar +class Footbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoorbarBoxed +sealed interface FoorbarBoxed
+permits
+[FoorbarBoxedNumber](#foorbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoorbarBoxedNumber +data class FoorbarBoxedNumber
+implements [FoorbarBoxed](#foorbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoorbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foorbar +class Foorbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Foobar1Boxed +sealed interface Foobar1Boxed
+permits
+[Foobar1BoxedNumber](#foobar1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## Foobar1BoxedNumber +data class Foobar1BoxedNumber
+implements [Foobar1Boxed](#foobar1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Foobar1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foobar1 +class Foobar1
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoobarBoxed +sealed interface FoobarBoxed
+permits
+[FoobarBoxedNumber](#foobarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoobarBoxedNumber +data class FoobarBoxedNumber
+implements [FoobarBoxed](#foobarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoobarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foobar +class Foobar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FoonbarBoxed +sealed interface FoonbarBoxed
+permits
+[FoonbarBoxedNumber](#foonbarboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## FoonbarBoxedNumber +data class FoonbarBoxedNumber
+implements [FoonbarBoxed](#foonbarboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FoonbarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Foonbar +class Foonbar
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..5e0d69eee7d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,250 @@ +# PropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.PropertiesWithNullValuedInstanceProperties.java +class PropertiesWithNullValuedInstanceProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed)
sealed interface for validated payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedVoid](#propertieswithnullvaluedinstanceproperties1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedBoolean](#propertieswithnullvaluedinstanceproperties1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedNumber](#propertieswithnullvaluedinstanceproperties1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedString](#propertieswithnullvaluedinstanceproperties1boxedstring)
boxed class to store validated String payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedList](#propertieswithnullvaluedinstanceproperties1boxedlist)
boxed class to store validated List payloads | +| record | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1BoxedMap](#propertieswithnullvaluedinstanceproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1](#propertieswithnullvaluedinstanceproperties1)
schema class | +| static class | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder)
builder for Map payloads | +| static class | [PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap)
output class for Map payloads | +| sealed interface | [PropertiesWithNullValuedInstanceProperties.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [PropertiesWithNullValuedInstanceProperties.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| static class | [PropertiesWithNullValuedInstanceProperties.Foo](#foo)
schema class | + +## PropertiesWithNullValuedInstanceProperties1Boxed +sealed interface PropertiesWithNullValuedInstanceProperties1Boxed
+permits
+[PropertiesWithNullValuedInstanceProperties1BoxedVoid](#propertieswithnullvaluedinstanceproperties1boxedvoid), +[PropertiesWithNullValuedInstanceProperties1BoxedBoolean](#propertieswithnullvaluedinstanceproperties1boxedboolean), +[PropertiesWithNullValuedInstanceProperties1BoxedNumber](#propertieswithnullvaluedinstanceproperties1boxednumber), +[PropertiesWithNullValuedInstanceProperties1BoxedString](#propertieswithnullvaluedinstanceproperties1boxedstring), +[PropertiesWithNullValuedInstanceProperties1BoxedList](#propertieswithnullvaluedinstanceproperties1boxedlist), +[PropertiesWithNullValuedInstanceProperties1BoxedMap](#propertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertiesWithNullValuedInstanceProperties1BoxedVoid +data class PropertiesWithNullValuedInstanceProperties1BoxedVoid
+implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedBoolean +data class PropertiesWithNullValuedInstanceProperties1BoxedBoolean
+implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedNumber +data class PropertiesWithNullValuedInstanceProperties1BoxedNumber
+implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedString +data class PropertiesWithNullValuedInstanceProperties1BoxedString
+implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedList +data class PropertiesWithNullValuedInstanceProperties1BoxedList
+implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithNullValuedInstanceProperties1BoxedMap +data class PropertiesWithNullValuedInstanceProperties1BoxedMap
+implements [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstanceProperties1BoxedMap([PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertiesWithNullValuedInstanceProperties1 +class PropertiesWithNullValuedInstanceProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) | validate(arg: [Map<?, ?>](#propertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedString](#propertieswithnullvaluedinstanceproperties1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedVoid](#propertieswithnullvaluedinstanceproperties1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedNumber](#propertieswithnullvaluedinstanceproperties1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedBoolean](#propertieswithnullvaluedinstanceproperties1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedMap](#propertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox([Map<?, ?>](#propertieswithnullvaluedinstancepropertiesmapbuilder), configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1BoxedList](#propertieswithnullvaluedinstanceproperties1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertiesWithNullValuedInstanceProperties1Boxed](#propertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertiesWithNullValuedInstancePropertiesMapBuilder +class PropertiesWithNullValuedInstancePropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertiesWithNullValuedInstancePropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | foo(value: Nothing?) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: String) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: List) | +| [PropertiesWithNullValuedInstancePropertiesMapBuilder](#propertieswithnullvaluedinstancepropertiesmapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertiesWithNullValuedInstancePropertiesMap +class PropertiesWithNullValuedInstancePropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertiesWithNullValuedInstancePropertiesMap](#propertieswithnullvaluedinstancepropertiesmap) | of([Map](#propertieswithnullvaluedinstancepropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| Nothing? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md new file mode 100644 index 00000000000..9a3d24c717a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertyNamedRefThatIsNotAReference.md @@ -0,0 +1,250 @@ +# PropertyNamedRefThatIsNotAReference +org.openapijsonschematools.client.components.schemas.PropertyNamedRefThatIsNotAReference.java +class PropertyNamedRefThatIsNotAReference
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed)
sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring)
boxed class to store validated String payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist)
boxed class to store validated List payloads | +| record | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1](#propertynamedrefthatisnotareference1)
schema class | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder)
builder for Map payloads | +| static class | [PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap)
output class for Map payloads | +| sealed interface | [PropertyNamedRefThatIsNotAReference.RefBoxed](#refboxed)
sealed interface for validated payloads | +| record | [PropertyNamedRefThatIsNotAReference.RefBoxedString](#refboxedstring)
boxed class to store validated String payloads | +| static class | [PropertyNamedRefThatIsNotAReference.Ref](#ref)
schema class | + +## PropertyNamedRefThatIsNotAReference1Boxed +sealed interface PropertyNamedRefThatIsNotAReference1Boxed
+permits
+[PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid), +[PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean), +[PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber), +[PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring), +[PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist), +[PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamedRefThatIsNotAReference1BoxedVoid +data class PropertyNamedRefThatIsNotAReference1BoxedVoid
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedBoolean +data class PropertyNamedRefThatIsNotAReference1BoxedBoolean
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedNumber +data class PropertyNamedRefThatIsNotAReference1BoxedNumber
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedString +data class PropertyNamedRefThatIsNotAReference1BoxedString
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedList +data class PropertyNamedRefThatIsNotAReference1BoxedList
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1BoxedMap +data class PropertyNamedRefThatIsNotAReference1BoxedMap
+implements [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReference1BoxedMap([PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNamedRefThatIsNotAReference1 +class PropertyNamedRefThatIsNotAReference1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "\$ref" to [Ref::class.java](#ref))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | validate(arg: [Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedString](#propertynamedrefthatisnotareference1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedVoid](#propertynamedrefthatisnotareference1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedNumber](#propertynamedrefthatisnotareference1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedBoolean](#propertynamedrefthatisnotareference1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedMap](#propertynamedrefthatisnotareference1boxedmap) | validateAndBox([Map<?, ?>](#propertynamedrefthatisnotareferencemapbuilder), configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1BoxedList](#propertynamedrefthatisnotareference1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertyNamedRefThatIsNotAReference1Boxed](#propertynamedrefthatisnotareference1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertyNamedRefThatIsNotAReferenceMapBuilder +class PropertyNamedRefThatIsNotAReferenceMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamedRefThatIsNotAReferenceMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | reverseSolidusDollarSignRef(value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Boolean) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: String) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Int) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Float) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Long) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Double) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: List) | +| [PropertyNamedRefThatIsNotAReferenceMapBuilder](#propertynamedrefthatisnotareferencemapbuilder) | additionalProperty(key: String, value: Map) | + +## PropertyNamedRefThatIsNotAReferenceMap +class PropertyNamedRefThatIsNotAReferenceMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [PropertyNamedRefThatIsNotAReferenceMap](#propertynamedrefthatisnotareferencemap) | of([Map](#propertynamedrefthatisnotareferencemapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["\$ref"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## RefBoxed +sealed interface RefBoxed
+permits
+[RefBoxedString](#refboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## RefBoxedString +data class RefBoxedString
+implements [RefBoxed](#refboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RefBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Ref +class Ref
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertynamesValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertynamesValidation.md new file mode 100644 index 00000000000..7f91cbf1956 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/PropertynamesValidation.md @@ -0,0 +1,239 @@ +# PropertynamesValidation +org.openapijsonschematools.client.components.schemas.PropertynamesValidation.java +class PropertynamesValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [PropertynamesValidation.PropertynamesValidation1Boxed](#propertynamesvalidation1boxed)
sealed interface for validated payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedVoid](#propertynamesvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedBoolean](#propertynamesvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedNumber](#propertynamesvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedString](#propertynamesvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedList](#propertynamesvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [PropertynamesValidation.PropertynamesValidation1BoxedMap](#propertynamesvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [PropertynamesValidation.PropertynamesValidation1](#propertynamesvalidation1)
schema class | +| sealed interface | [PropertynamesValidation.PropertyNamesBoxed](#propertynamesboxed)
sealed interface for validated payloads | +| record | [PropertynamesValidation.PropertyNamesBoxedString](#propertynamesboxedstring)
boxed class to store validated String payloads | +| static class | [PropertynamesValidation.PropertyNames](#propertynames)
schema class | + +## PropertynamesValidation1Boxed +sealed interface PropertynamesValidation1Boxed
+permits
+[PropertynamesValidation1BoxedVoid](#propertynamesvalidation1boxedvoid), +[PropertynamesValidation1BoxedBoolean](#propertynamesvalidation1boxedboolean), +[PropertynamesValidation1BoxedNumber](#propertynamesvalidation1boxednumber), +[PropertynamesValidation1BoxedString](#propertynamesvalidation1boxedstring), +[PropertynamesValidation1BoxedList](#propertynamesvalidation1boxedlist), +[PropertynamesValidation1BoxedMap](#propertynamesvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## PropertynamesValidation1BoxedVoid +data class PropertynamesValidation1BoxedVoid
+implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertynamesValidation1BoxedBoolean +data class PropertynamesValidation1BoxedBoolean
+implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertynamesValidation1BoxedNumber +data class PropertynamesValidation1BoxedNumber
+implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertynamesValidation1BoxedString +data class PropertynamesValidation1BoxedString
+implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertynamesValidation1BoxedList +data class PropertynamesValidation1BoxedList
+implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertynamesValidation1BoxedMap +data class PropertynamesValidation1BoxedMap
+implements [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertynamesValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertynamesValidation1 +class PropertynamesValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | propertyNames = [PropertyNames::class.java](#propertynames) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedString](#propertynamesvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedVoid](#propertynamesvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedNumber](#propertynamesvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedBoolean](#propertynamesvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedMap](#propertynamesvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [PropertynamesValidation1BoxedList](#propertynamesvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [PropertynamesValidation1Boxed](#propertynamesvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## PropertyNamesBoxed +sealed interface PropertyNamesBoxed
+permits
+[PropertyNamesBoxedString](#propertynamesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamesBoxedString +data class PropertyNamesBoxedString
+implements [PropertyNamesBoxed](#propertynamesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNames +class PropertyNames
+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.PropertynamesValidation; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = PropertynamesValidation.PropertyNames.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Integer | maxLength = 3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxedString](#propertynamesboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxed](#propertynamesboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexFormat.md new file mode 100644 index 00000000000..7c3bd4263ab --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexFormat.md @@ -0,0 +1,169 @@ +# RegexFormat +org.openapijsonschematools.client.components.schemas.RegexFormat.java +class RegexFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RegexFormat.RegexFormat1Boxed](#regexformat1boxed)
sealed interface for validated payloads | +| record | [RegexFormat.RegexFormat1BoxedVoid](#regexformat1boxedvoid)
boxed class to store validated null payloads | +| record | [RegexFormat.RegexFormat1BoxedBoolean](#regexformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RegexFormat.RegexFormat1BoxedNumber](#regexformat1boxednumber)
boxed class to store validated Number payloads | +| record | [RegexFormat.RegexFormat1BoxedString](#regexformat1boxedstring)
boxed class to store validated String payloads | +| record | [RegexFormat.RegexFormat1BoxedList](#regexformat1boxedlist)
boxed class to store validated List payloads | +| record | [RegexFormat.RegexFormat1BoxedMap](#regexformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [RegexFormat.RegexFormat1](#regexformat1)
schema class | + +## RegexFormat1Boxed +sealed interface RegexFormat1Boxed
+permits
+[RegexFormat1BoxedVoid](#regexformat1boxedvoid), +[RegexFormat1BoxedBoolean](#regexformat1boxedboolean), +[RegexFormat1BoxedNumber](#regexformat1boxednumber), +[RegexFormat1BoxedString](#regexformat1boxedstring), +[RegexFormat1BoxedList](#regexformat1boxedlist), +[RegexFormat1BoxedMap](#regexformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RegexFormat1BoxedVoid +data class RegexFormat1BoxedVoid
+implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexFormat1BoxedBoolean +data class RegexFormat1BoxedBoolean
+implements [RegexFormat1Boxed](#regexformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexFormat1BoxedNumber +data class RegexFormat1BoxedNumber
+implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexFormat1BoxedString +data class RegexFormat1BoxedString
+implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexFormat1BoxedList +data class RegexFormat1BoxedList
+implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexFormat1BoxedMap +data class RegexFormat1BoxedMap
+implements [RegexFormat1Boxed](#regexformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexFormat1 +class RegexFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "regex"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedString](#regexformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedVoid](#regexformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedNumber](#regexformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedBoolean](#regexformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedMap](#regexformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RegexFormat1BoxedList](#regexformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RegexFormat1Boxed](#regexformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md new file mode 100644 index 00000000000..3fd0b57972a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.md @@ -0,0 +1,245 @@ +# RegexesAreNotAnchoredByDefaultAndAreCaseSensitive +org.openapijsonschematools.client.components.schemas.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.java +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed)
sealed interface for validated payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid](#regexesarenotanchoredbydefaultandarecasesensitive1boxedvoid)
boxed class to store validated null payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean](#regexesarenotanchoredbydefaultandarecasesensitive1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber](#regexesarenotanchoredbydefaultandarecasesensitive1boxednumber)
boxed class to store validated Number payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString](#regexesarenotanchoredbydefaultandarecasesensitive1boxedstring)
boxed class to store validated String payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList](#regexesarenotanchoredbydefaultandarecasesensitive1boxedlist)
boxed class to store validated List payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap](#regexesarenotanchoredbydefaultandarecasesensitive1boxedmap)
boxed class to store validated Map payloads | +| static class | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1](#regexesarenotanchoredbydefaultandarecasesensitive1)
schema class | +| sealed interface | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.XBoxed](#xboxed)
sealed interface for validated payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.XBoxedString](#xboxedstring)
boxed class to store validated String payloads | +| static class | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.X](#x)
schema class | +| sealed interface | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.Schema092Boxed](#schema092boxed)
sealed interface for validated payloads | +| record | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.Schema092BoxedBoolean](#schema092boxedboolean)
boxed class to store validated boolean payloads | +| static class | [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.Schema092](#schema092)
schema class | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed +sealed interface RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed
+permits
+[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid](#regexesarenotanchoredbydefaultandarecasesensitive1boxedvoid), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean](#regexesarenotanchoredbydefaultandarecasesensitive1boxedboolean), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber](#regexesarenotanchoredbydefaultandarecasesensitive1boxednumber), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString](#regexesarenotanchoredbydefaultandarecasesensitive1boxedstring), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList](#regexesarenotanchoredbydefaultandarecasesensitive1boxedlist), +[RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap](#regexesarenotanchoredbydefaultandarecasesensitive1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid
+implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean
+implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber
+implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString
+implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList
+implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap +data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap
+implements [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1 +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | patternProperties = mapOf(
    Pattern.compile("[0-9]{2,}") to [Schema092::class.java](#schema092)),
    Pattern.compile("X_") to [X::class.java](#x))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString](#regexesarenotanchoredbydefaultandarecasesensitive1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid](#regexesarenotanchoredbydefaultandarecasesensitive1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber](#regexesarenotanchoredbydefaultandarecasesensitive1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean](#regexesarenotanchoredbydefaultandarecasesensitive1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap](#regexesarenotanchoredbydefaultandarecasesensitive1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList](#regexesarenotanchoredbydefaultandarecasesensitive1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed](#regexesarenotanchoredbydefaultandarecasesensitive1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## XBoxed +sealed interface XBoxed
+permits
+[XBoxedString](#xboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## XBoxedString +data class XBoxedString
+implements [XBoxed](#xboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| XBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## X +class X
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema092Boxed +sealed interface Schema092Boxed
+permits
+[Schema092BoxedBoolean](#schema092boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema092BoxedBoolean +data class Schema092BoxedBoolean
+implements [Schema092Boxed](#schema092boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema092BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema092 +class Schema092
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RelativeJsonPointerFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RelativeJsonPointerFormat.md new file mode 100644 index 00000000000..49a4a60eec1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RelativeJsonPointerFormat.md @@ -0,0 +1,169 @@ +# RelativeJsonPointerFormat +org.openapijsonschematools.client.components.schemas.RelativeJsonPointerFormat.java +class RelativeJsonPointerFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed)
sealed interface for validated payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedVoid](#relativejsonpointerformat1boxedvoid)
boxed class to store validated null payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedBoolean](#relativejsonpointerformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedNumber](#relativejsonpointerformat1boxednumber)
boxed class to store validated Number payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedString](#relativejsonpointerformat1boxedstring)
boxed class to store validated String payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedList](#relativejsonpointerformat1boxedlist)
boxed class to store validated List payloads | +| record | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1BoxedMap](#relativejsonpointerformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [RelativeJsonPointerFormat.RelativeJsonPointerFormat1](#relativejsonpointerformat1)
schema class | + +## RelativeJsonPointerFormat1Boxed +sealed interface RelativeJsonPointerFormat1Boxed
+permits
+[RelativeJsonPointerFormat1BoxedVoid](#relativejsonpointerformat1boxedvoid), +[RelativeJsonPointerFormat1BoxedBoolean](#relativejsonpointerformat1boxedboolean), +[RelativeJsonPointerFormat1BoxedNumber](#relativejsonpointerformat1boxednumber), +[RelativeJsonPointerFormat1BoxedString](#relativejsonpointerformat1boxedstring), +[RelativeJsonPointerFormat1BoxedList](#relativejsonpointerformat1boxedlist), +[RelativeJsonPointerFormat1BoxedMap](#relativejsonpointerformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RelativeJsonPointerFormat1BoxedVoid +data class RelativeJsonPointerFormat1BoxedVoid
+implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RelativeJsonPointerFormat1BoxedBoolean +data class RelativeJsonPointerFormat1BoxedBoolean
+implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RelativeJsonPointerFormat1BoxedNumber +data class RelativeJsonPointerFormat1BoxedNumber
+implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RelativeJsonPointerFormat1BoxedString +data class RelativeJsonPointerFormat1BoxedString
+implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RelativeJsonPointerFormat1BoxedList +data class RelativeJsonPointerFormat1BoxedList
+implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RelativeJsonPointerFormat1BoxedMap +data class RelativeJsonPointerFormat1BoxedMap
+implements [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RelativeJsonPointerFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## RelativeJsonPointerFormat1 +class RelativeJsonPointerFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "relative-json-pointer"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedString](#relativejsonpointerformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedVoid](#relativejsonpointerformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedNumber](#relativejsonpointerformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedBoolean](#relativejsonpointerformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedMap](#relativejsonpointerformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1BoxedList](#relativejsonpointerformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RelativeJsonPointerFormat1Boxed](#relativejsonpointerformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md new file mode 100644 index 00000000000..7b71ca0e3f6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredDefaultValidation.md @@ -0,0 +1,353 @@ +# RequiredDefaultValidation +org.openapijsonschematools.client.components.schemas.RequiredDefaultValidation.java +class RequiredDefaultValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredDefaultValidation.RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed)
sealed interface for validated payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidation1](#requireddefaultvalidation1)
schema class | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder)
builder for Map payloads | +| static class | [RequiredDefaultValidation.RequiredDefaultValidationMap](#requireddefaultvalidationmap)
output class for Map payloads | +| sealed interface | [RequiredDefaultValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredDefaultValidation.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredDefaultValidation.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredDefaultValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredDefaultValidation.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredDefaultValidation.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredDefaultValidation.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredDefaultValidation.Foo](#foo)
schema class | + +## RequiredDefaultValidation1Boxed +sealed interface RequiredDefaultValidation1Boxed
+permits
+[RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid), +[RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean), +[RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber), +[RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring), +[RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist), +[RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredDefaultValidation1BoxedVoid +data class RequiredDefaultValidation1BoxedVoid
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedBoolean +data class RequiredDefaultValidation1BoxedBoolean
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedNumber +data class RequiredDefaultValidation1BoxedNumber
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedString +data class RequiredDefaultValidation1BoxedString
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedList +data class RequiredDefaultValidation1BoxedList
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1BoxedMap +data class RequiredDefaultValidation1BoxedMap
+implements [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidation1BoxedMap([RequiredDefaultValidationMap](#requireddefaultvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredDefaultValidation1 +class RequiredDefaultValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | validate(arg: [Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedString](#requireddefaultvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedVoid](#requireddefaultvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedNumber](#requireddefaultvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedBoolean](#requireddefaultvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedMap](#requireddefaultvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requireddefaultvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1BoxedList](#requireddefaultvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredDefaultValidation1Boxed](#requireddefaultvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredDefaultValidationMapBuilder +class RequiredDefaultValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredDefaultValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | foo(value: Map) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredDefaultValidationMapBuilder](#requireddefaultvalidationmapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredDefaultValidationMap +class RequiredDefaultValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredDefaultValidationMap](#requireddefaultvalidationmap) | of([Map](#requireddefaultvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md new file mode 100644 index 00000000000..da432b91f7e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.md @@ -0,0 +1,424 @@ +# RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames +org.openapijsonschematools.client.components.schemas.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.java +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed)
sealed interface for validated payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1)
schema class | +| static class | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder)
builder for Map payloads | +| static class | [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap)
output class for Map payloads | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed +sealed interface RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed
+permits
+[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedvoid), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedboolean), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxednumber), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedstring), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedlist), +[RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid
+implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean
+implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber
+implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString
+implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList
+implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap +data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap
+implements [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap([RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1 +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "__proto__",
    "constructor",
    "toString"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) | validate(arg: [Map<?, ?>](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedmap) | validateAndBox([Map<?, ?>](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder), configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed](#requiredpropertieswhosenamesarejavascriptobjectpropertynames1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | additionalProperty(key: String, value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | setConstructor(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | setConstructor(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap000builder) | lowLineProto(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap001builder) | lowLineProto(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap010builder) | lowLineProto(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap100builder) | setConstructor(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap011builder) | lowLineProto(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap101builder) | setConstructor(value: Map) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Nothing?) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Boolean) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: String) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Int) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Float) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Long) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Double) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: List) | +| [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap110builder) | toString(value: Map) | + +## RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmap) | of([Map](#requiredpropertieswhosenamesarejavascriptobjectpropertynamesmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["__proto__"], instance["constructor"], instance["toString"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredValidation.md new file mode 100644 index 00000000000..448abb465fe --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredValidation.md @@ -0,0 +1,512 @@ +# RequiredValidation +org.openapijsonschematools.client.components.schemas.RequiredValidation.java +class RequiredValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredValidation.RequiredValidation1Boxed](#requiredvalidation1boxed)
sealed interface for validated payloads | +| record | [RequiredValidation.RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.RequiredValidation1BoxedString](#requiredvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.RequiredValidation1BoxedList](#requiredvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.RequiredValidation1BoxedMap](#requiredvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.RequiredValidation1](#requiredvalidation1)
schema class | +| static class | [RequiredValidation.RequiredValidationMapBuilder](#requiredvalidationmapbuilder)
builder for Map payloads | +| static class | [RequiredValidation.RequiredValidationMap](#requiredvalidationmap)
output class for Map payloads | +| sealed interface | [RequiredValidation.BarBoxed](#barboxed)
sealed interface for validated payloads | +| record | [RequiredValidation.BarBoxedVoid](#barboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.BarBoxedBoolean](#barboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.BarBoxedNumber](#barboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.BarBoxedString](#barboxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.BarBoxedList](#barboxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.BarBoxedMap](#barboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.Bar](#bar)
schema class | +| sealed interface | [RequiredValidation.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredValidation.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredValidation.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredValidation.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredValidation.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredValidation.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredValidation.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredValidation.Foo](#foo)
schema class | + +## RequiredValidation1Boxed +sealed interface RequiredValidation1Boxed
+permits
+[RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid), +[RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean), +[RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber), +[RequiredValidation1BoxedString](#requiredvalidation1boxedstring), +[RequiredValidation1BoxedList](#requiredvalidation1boxedlist), +[RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredValidation1BoxedVoid +data class RequiredValidation1BoxedVoid
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedBoolean +data class RequiredValidation1BoxedBoolean
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedNumber +data class RequiredValidation1BoxedNumber
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedString +data class RequiredValidation1BoxedString
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedList +data class RequiredValidation1BoxedList
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1BoxedMap +data class RequiredValidation1BoxedMap
+implements [RequiredValidation1Boxed](#requiredvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidation1BoxedMap([RequiredValidationMap](#requiredvalidationmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap](#requiredvalidationmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredValidation1 +class RequiredValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo)),
    "bar" to [Bar::class.java](#bar))
)
| +| Set | required = setOf(
    "foo"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredValidationMap](#requiredvalidationmap) | validate(arg: [Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedString](#requiredvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedVoid](#requiredvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedNumber](#requiredvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedBoolean](#requiredvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedMap](#requiredvalidation1boxedmap) | validateAndBox([Map<?, ?>](#requiredvalidationmapbuilder), configuration: SchemaConfiguration) | +| [RequiredValidation1BoxedList](#requiredvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredValidation1Boxed](#requiredvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredValidationMap0Builder +class RequiredValidationMap0Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMap0Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | bar(value: Map) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | additionalProperty(key: String, value: Map) | + +## RequiredValidationMapBuilder +class RequiredValidationMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredValidationMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Nothing?) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Boolean) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: String) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Int) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Float) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Long) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Double) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: List) | +| [RequiredValidationMap0Builder](#requiredvalidationmap0builder) | foo(value: Map) | + +## RequiredValidationMap +class RequiredValidationMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredValidationMap](#requiredvalidationmap) | of([Map](#requiredvalidationmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
| +| Any? | bar()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## BarBoxed +sealed interface BarBoxed
+permits
+[BarBoxedVoid](#barboxedvoid), +[BarBoxedBoolean](#barboxedboolean), +[BarBoxedNumber](#barboxednumber), +[BarBoxedString](#barboxedstring), +[BarBoxedList](#barboxedlist), +[BarBoxedMap](#barboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## BarBoxedVoid +data class BarBoxedVoid
+implements [BarBoxed](#barboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedBoolean +data class BarBoxedBoolean
+implements [BarBoxed](#barboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedNumber +data class BarBoxedNumber
+implements [BarBoxed](#barboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedString +data class BarBoxedString
+implements [BarBoxed](#barboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedList +data class BarBoxedList
+implements [BarBoxed](#barboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## BarBoxedMap +data class BarBoxedMap
+implements [BarBoxed](#barboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| BarBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Bar +class Bar
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md new file mode 100644 index 00000000000..85125a5f8d2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEmptyArray.md @@ -0,0 +1,353 @@ +# RequiredWithEmptyArray +org.openapijsonschematools.client.components.schemas.RequiredWithEmptyArray.java +class RequiredWithEmptyArray
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredWithEmptyArray.RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed)
sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArray1](#requiredwithemptyarray1)
schema class | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder)
builder for Map payloads | +| static class | [RequiredWithEmptyArray.RequiredWithEmptyArrayMap](#requiredwithemptyarraymap)
output class for Map payloads | +| sealed interface | [RequiredWithEmptyArray.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [RequiredWithEmptyArray.FooBoxedVoid](#fooboxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEmptyArray.FooBoxedBoolean](#fooboxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEmptyArray.FooBoxedNumber](#fooboxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEmptyArray.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEmptyArray.FooBoxedList](#fooboxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEmptyArray.FooBoxedMap](#fooboxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEmptyArray.Foo](#foo)
schema class | + +## RequiredWithEmptyArray1Boxed +sealed interface RequiredWithEmptyArray1Boxed
+permits
+[RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid), +[RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean), +[RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber), +[RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring), +[RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist), +[RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEmptyArray1BoxedVoid +data class RequiredWithEmptyArray1BoxedVoid
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedBoolean +data class RequiredWithEmptyArray1BoxedBoolean
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedNumber +data class RequiredWithEmptyArray1BoxedNumber
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedString +data class RequiredWithEmptyArray1BoxedString
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedList +data class RequiredWithEmptyArray1BoxedList
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1BoxedMap +data class RequiredWithEmptyArray1BoxedMap
+implements [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArray1BoxedMap([RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEmptyArray1 +class RequiredWithEmptyArray1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | validate(arg: [Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedString](#requiredwithemptyarray1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedVoid](#requiredwithemptyarray1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedNumber](#requiredwithemptyarray1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedBoolean](#requiredwithemptyarray1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedMap](#requiredwithemptyarray1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithemptyarraymapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1BoxedList](#requiredwithemptyarray1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEmptyArray1Boxed](#requiredwithemptyarray1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEmptyArrayMapBuilder +class RequiredWithEmptyArrayMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEmptyArrayMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | foo(value: Map) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: String) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: List) | +| [RequiredWithEmptyArrayMapBuilder](#requiredwithemptyarraymapbuilder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEmptyArrayMap +class RequiredWithEmptyArrayMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEmptyArrayMap](#requiredwithemptyarraymap) | of([Map](#requiredwithemptyarraymapbuilder) arg, SchemaConfiguration configuration) | +| Any? | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedVoid](#fooboxedvoid), +[FooBoxedBoolean](#fooboxedboolean), +[FooBoxedNumber](#fooboxednumber), +[FooBoxedString](#fooboxedstring), +[FooBoxedList](#fooboxedlist), +[FooBoxedMap](#fooboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedVoid +data class FooBoxedVoid
+implements [FooBoxed](#fooboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedBoolean +data class FooBoxedBoolean
+implements [FooBoxed](#fooboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedNumber +data class FooBoxedNumber
+implements [FooBoxed](#fooboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedList +data class FooBoxedList
+implements [FooBoxed](#fooboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## FooBoxedMap +data class FooBoxedMap
+implements [FooBoxed](#fooboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md new file mode 100644 index 00000000000..eb8d365df0d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/RequiredWithEscapedCharacters.md @@ -0,0 +1,2884 @@ +# RequiredWithEscapedCharacters +org.openapijsonschematools.client.components.schemas.RequiredWithEscapedCharacters.java +class RequiredWithEscapedCharacters
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed)
sealed interface for validated payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid)
boxed class to store validated null payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean)
boxed class to store validated boolean payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber)
boxed class to store validated Number payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring)
boxed class to store validated String payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist)
boxed class to store validated List payloads | +| record | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap)
boxed class to store validated Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1](#requiredwithescapedcharacters1)
schema class | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMapBuilder](#requiredwithescapedcharactersmapbuilder)
builder for Map payloads | +| static class | [RequiredWithEscapedCharacters.RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap)
output class for Map payloads | + +## RequiredWithEscapedCharacters1Boxed +sealed interface RequiredWithEscapedCharacters1Boxed
+permits
+[RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid), +[RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean), +[RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber), +[RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring), +[RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist), +[RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## RequiredWithEscapedCharacters1BoxedVoid +data class RequiredWithEscapedCharacters1BoxedVoid
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedBoolean +data class RequiredWithEscapedCharacters1BoxedBoolean
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedNumber +data class RequiredWithEscapedCharacters1BoxedNumber
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedString +data class RequiredWithEscapedCharacters1BoxedString
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedList +data class RequiredWithEscapedCharacters1BoxedList
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1BoxedMap +data class RequiredWithEscapedCharacters1BoxedMap
+implements [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharacters1BoxedMap([RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## RequiredWithEscapedCharacters1 +class RequiredWithEscapedCharacters1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set | required = setOf(
    "foo\tbar",
    "foo\nbar",
    "foo\u000Cbar",
    "foo\rbar",
    "foo\"bar",
    "foo\\bar"
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | validate(arg: [Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedString](#requiredwithescapedcharacters1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedVoid](#requiredwithescapedcharacters1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedNumber](#requiredwithescapedcharacters1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedBoolean](#requiredwithescapedcharacters1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedMap](#requiredwithescapedcharacters1boxedmap) | validateAndBox([Map<?, ?>](#requiredwithescapedcharactersmapbuilder), configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1BoxedList](#requiredwithescapedcharacters1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [RequiredWithEscapedCharacters1Boxed](#requiredwithescapedcharacters1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## RequiredWithEscapedCharactersMap000000Builder +class RequiredWithEscapedCharactersMap000000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | additionalProperty(key: String, value: Map) | + +## RequiredWithEscapedCharactersMap000001Builder +class RequiredWithEscapedCharactersMap000001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000010Builder +class RequiredWithEscapedCharactersMap000010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000011Builder +class RequiredWithEscapedCharactersMap000011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000100Builder +class RequiredWithEscapedCharactersMap000100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap000101Builder +class RequiredWithEscapedCharactersMap000101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap000110Builder +class RequiredWithEscapedCharactersMap000110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap000111Builder +class RequiredWithEscapedCharactersMap000111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap000111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001000Builder +class RequiredWithEscapedCharactersMap001000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap001001Builder +class RequiredWithEscapedCharactersMap001001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001010Builder +class RequiredWithEscapedCharactersMap001010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001011Builder +class RequiredWithEscapedCharactersMap001011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001100Builder +class RequiredWithEscapedCharactersMap001100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap001101Builder +class RequiredWithEscapedCharactersMap001101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap001110Builder +class RequiredWithEscapedCharactersMap001110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap001111Builder +class RequiredWithEscapedCharactersMap001111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap001111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010000Builder +class RequiredWithEscapedCharactersMap010000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap010001Builder +class RequiredWithEscapedCharactersMap010001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010010Builder +class RequiredWithEscapedCharactersMap010010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010011Builder +class RequiredWithEscapedCharactersMap010011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010100Builder +class RequiredWithEscapedCharactersMap010100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap010101Builder +class RequiredWithEscapedCharactersMap010101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap010110Builder +class RequiredWithEscapedCharactersMap010110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap010111Builder +class RequiredWithEscapedCharactersMap010111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap010111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011000Builder +class RequiredWithEscapedCharactersMap011000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap011001Builder +class RequiredWithEscapedCharactersMap011001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011010Builder +class RequiredWithEscapedCharactersMap011010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011011Builder +class RequiredWithEscapedCharactersMap011011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011100Builder +class RequiredWithEscapedCharactersMap011100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap011101Builder +class RequiredWithEscapedCharactersMap011101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap011110Builder +class RequiredWithEscapedCharactersMap011110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap011111Builder +class RequiredWithEscapedCharactersMap011111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap011111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100000Builder +class RequiredWithEscapedCharactersMap100000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000000Builder](#requiredwithescapedcharactersmap000000builder) | fooReverseSolidusTbar(value: Map) | + +## RequiredWithEscapedCharactersMap100001Builder +class RequiredWithEscapedCharactersMap100001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000001Builder](#requiredwithescapedcharactersmap000001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100010Builder +class RequiredWithEscapedCharactersMap100010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000010Builder](#requiredwithescapedcharactersmap000010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100011Builder +class RequiredWithEscapedCharactersMap100011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000011Builder](#requiredwithescapedcharactersmap000011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100100Builder +class RequiredWithEscapedCharactersMap100100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000100Builder](#requiredwithescapedcharactersmap000100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap100101Builder +class RequiredWithEscapedCharactersMap100101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000101Builder](#requiredwithescapedcharactersmap000101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap100110Builder +class RequiredWithEscapedCharactersMap100110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000110Builder](#requiredwithescapedcharactersmap000110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap100111Builder +class RequiredWithEscapedCharactersMap100111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap100111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap000111Builder](#requiredwithescapedcharactersmap000111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101000Builder +class RequiredWithEscapedCharactersMap101000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001000Builder](#requiredwithescapedcharactersmap001000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap101001Builder +class RequiredWithEscapedCharactersMap101001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001001Builder](#requiredwithescapedcharactersmap001001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101010Builder +class RequiredWithEscapedCharactersMap101010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001010Builder](#requiredwithescapedcharactersmap001010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101011Builder +class RequiredWithEscapedCharactersMap101011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001011Builder](#requiredwithescapedcharactersmap001011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101100Builder +class RequiredWithEscapedCharactersMap101100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001100Builder](#requiredwithescapedcharactersmap001100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap101101Builder +class RequiredWithEscapedCharactersMap101101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001101Builder](#requiredwithescapedcharactersmap001101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap101110Builder +class RequiredWithEscapedCharactersMap101110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001110Builder](#requiredwithescapedcharactersmap001110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap101111Builder +class RequiredWithEscapedCharactersMap101111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap101111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap001111Builder](#requiredwithescapedcharactersmap001111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110000Builder +class RequiredWithEscapedCharactersMap110000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010000Builder](#requiredwithescapedcharactersmap010000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100000Builder](#requiredwithescapedcharactersmap100000builder) | fooReverseSolidusNbar(value: Map) | + +## RequiredWithEscapedCharactersMap110001Builder +class RequiredWithEscapedCharactersMap110001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010001Builder](#requiredwithescapedcharactersmap010001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100001Builder](#requiredwithescapedcharactersmap100001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110010Builder +class RequiredWithEscapedCharactersMap110010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010010Builder](#requiredwithescapedcharactersmap010010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100010Builder](#requiredwithescapedcharactersmap100010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110011Builder +class RequiredWithEscapedCharactersMap110011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010011Builder](#requiredwithescapedcharactersmap010011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100011Builder](#requiredwithescapedcharactersmap100011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110100Builder +class RequiredWithEscapedCharactersMap110100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010100Builder](#requiredwithescapedcharactersmap010100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100100Builder](#requiredwithescapedcharactersmap100100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap110101Builder +class RequiredWithEscapedCharactersMap110101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010101Builder](#requiredwithescapedcharactersmap010101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100101Builder](#requiredwithescapedcharactersmap100101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap110110Builder +class RequiredWithEscapedCharactersMap110110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010110Builder](#requiredwithescapedcharactersmap010110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100110Builder](#requiredwithescapedcharactersmap100110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap110111Builder +class RequiredWithEscapedCharactersMap110111Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap110111Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap010111Builder](#requiredwithescapedcharactersmap010111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap100111Builder](#requiredwithescapedcharactersmap100111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111000Builder +class RequiredWithEscapedCharactersMap111000Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111000Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011000Builder](#requiredwithescapedcharactersmap011000builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101000Builder](#requiredwithescapedcharactersmap101000builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110000Builder](#requiredwithescapedcharactersmap110000builder) | fooReverseSolidusU000cbar(value: Map) | + +## RequiredWithEscapedCharactersMap111001Builder +class RequiredWithEscapedCharactersMap111001Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111001Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011001Builder](#requiredwithescapedcharactersmap011001builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101001Builder](#requiredwithescapedcharactersmap101001builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110001Builder](#requiredwithescapedcharactersmap110001builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111010Builder +class RequiredWithEscapedCharactersMap111010Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111010Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011010Builder](#requiredwithescapedcharactersmap011010builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101010Builder](#requiredwithescapedcharactersmap101010builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110010Builder](#requiredwithescapedcharactersmap110010builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMap111011Builder +class RequiredWithEscapedCharactersMap111011Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111011Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011011Builder](#requiredwithescapedcharactersmap011011builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101011Builder](#requiredwithescapedcharactersmap101011builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110011Builder](#requiredwithescapedcharactersmap110011builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111100Builder +class RequiredWithEscapedCharactersMap111100Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111100Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011100Builder](#requiredwithescapedcharactersmap011100builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101100Builder](#requiredwithescapedcharactersmap101100builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110100Builder](#requiredwithescapedcharactersmap110100builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111000Builder](#requiredwithescapedcharactersmap111000builder) | fooReverseSolidusRbar(value: Map) | + +## RequiredWithEscapedCharactersMap111101Builder +class RequiredWithEscapedCharactersMap111101Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111101Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011101Builder](#requiredwithescapedcharactersmap011101builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101101Builder](#requiredwithescapedcharactersmap101101builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110101Builder](#requiredwithescapedcharactersmap110101builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111001Builder](#requiredwithescapedcharactersmap111001builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap111110Builder +class RequiredWithEscapedCharactersMap111110Builder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMap111110Builder(Map instance)
Creates a builder that contains the passed instance | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011110Builder](#requiredwithescapedcharactersmap011110builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101110Builder](#requiredwithescapedcharactersmap101110builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110110Builder](#requiredwithescapedcharactersmap110110builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111010Builder](#requiredwithescapedcharactersmap111010builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111100Builder](#requiredwithescapedcharactersmap111100builder) | fooReverseSolidusQuotationMarkBar(value: Map) | + +## RequiredWithEscapedCharactersMapBuilder +class RequiredWithEscapedCharactersMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RequiredWithEscapedCharactersMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: String) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Int) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Float) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Long) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Double) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: List) | +| [RequiredWithEscapedCharactersMap011111Builder](#requiredwithescapedcharactersmap011111builder) | fooReverseSolidusTbar(value: Map) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: String) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Int) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Float) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Long) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Double) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: List) | +| [RequiredWithEscapedCharactersMap101111Builder](#requiredwithescapedcharactersmap101111builder) | fooReverseSolidusNbar(value: Map) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: String) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Int) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Float) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Long) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Double) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: List) | +| [RequiredWithEscapedCharactersMap110111Builder](#requiredwithescapedcharactersmap110111builder) | fooReverseSolidusU000cbar(value: Map) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: String) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Int) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Float) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Long) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Double) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: List) | +| [RequiredWithEscapedCharactersMap111011Builder](#requiredwithescapedcharactersmap111011builder) | fooReverseSolidusRbar(value: Map) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: String) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Int) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Float) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Long) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Double) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: List) | +| [RequiredWithEscapedCharactersMap111101Builder](#requiredwithescapedcharactersmap111101builder) | fooReverseSolidusQuotationMarkBar(value: Map) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Nothing?) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Boolean) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: String) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Int) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Float) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Long) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Double) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: List) | +| [RequiredWithEscapedCharactersMap111110Builder](#requiredwithescapedcharactersmap111110builder) | fooReverseSolidusReverseSolidusBar(value: Map) | + +## RequiredWithEscapedCharactersMap +class RequiredWithEscapedCharactersMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [RequiredWithEscapedCharactersMap](#requiredwithescapedcharactersmap) | of([Map](#requiredwithescapedcharactersmapbuilder) arg, SchemaConfiguration configuration) | +| Any? | get(String key)
This schema has invalid Kotlin names so this method must be used when you access instance["foo\tbar"], instance["foo\nbar"], instance["foo\u000Cbar"], instance["foo\rbar"], instance["foo\"bar"], instance["foo\\bar"], | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md new file mode 100644 index 00000000000..08da7286908 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SimpleEnumValidation.md @@ -0,0 +1,141 @@ +# SimpleEnumValidation +org.openapijsonschematools.client.components.schemas.SimpleEnumValidation.java +class SimpleEnumValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +- enum classes + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SimpleEnumValidation.SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed)
sealed interface for validated payloads | +| record | [SimpleEnumValidation.SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber)
boxed class to store validated Number payloads | +| static class | [SimpleEnumValidation.SimpleEnumValidation1](#simpleenumvalidation1)
schema class | +| enum | [SimpleEnumValidation.IntegerSimpleEnumValidationEnums](#integersimpleenumvalidationenums)
Integer enum | +| enum | [SimpleEnumValidation.LongSimpleEnumValidationEnums](#longsimpleenumvalidationenums)
Long enum | +| enum | [SimpleEnumValidation.FloatSimpleEnumValidationEnums](#floatsimpleenumvalidationenums)
Float enum | +| enum | [SimpleEnumValidation.DoubleSimpleEnumValidationEnums](#doublesimpleenumvalidationenums)
Double enum | + +## SimpleEnumValidation1Boxed +sealed interface SimpleEnumValidation1Boxed
+permits
+[SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SimpleEnumValidation1BoxedNumber +data class SimpleEnumValidation1BoxedNumber
+implements [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SimpleEnumValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## SimpleEnumValidation1 +class SimpleEnumValidation1
+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.SimpleEnumValidation; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = SimpleEnumValidation.SimpleEnumValidation1.validate( + 1, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| Set | enumValues = setOf(
    1,
    2,
    3
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1BoxedNumber](#simpleenumvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SimpleEnumValidation1Boxed](#simpleenumvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IntegerSimpleEnumValidationEnums +public enum IntegerSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Integer enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1 | +| POSITIVE_2 | value = 2 | +| POSITIVE_3 | value = 3 | + +## LongSimpleEnumValidationEnums +public enum LongSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Long enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1L | +| POSITIVE_2 | value = 2L | +| POSITIVE_3 | value = 3L | + +## FloatSimpleEnumValidationEnums +public enum FloatSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Float enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0f | +| POSITIVE_2 | value = 2.0f | +| POSITIVE_3 | value = 3.0f | + +## DoubleSimpleEnumValidationEnums +public enum DoubleSimpleEnumValidationEnums
+extends `Enum` + +A class that stores Double enum values + +### Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | +| POSITIVE_1 | value = 1.0d | +| POSITIVE_2 | value = 2.0d | +| POSITIVE_3 | value = 3.0d | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md new file mode 100644 index 00000000000..689e87a6389 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SingleDependency.md @@ -0,0 +1,177 @@ +# SingleDependency +org.openapijsonschematools.client.components.schemas.SingleDependency.java +class SingleDependency
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SingleDependency.SingleDependency1Boxed](#singledependency1boxed)
sealed interface for validated payloads | +| record | [SingleDependency.SingleDependency1BoxedVoid](#singledependency1boxedvoid)
boxed class to store validated null payloads | +| record | [SingleDependency.SingleDependency1BoxedBoolean](#singledependency1boxedboolean)
boxed class to store validated boolean payloads | +| record | [SingleDependency.SingleDependency1BoxedNumber](#singledependency1boxednumber)
boxed class to store validated Number payloads | +| record | [SingleDependency.SingleDependency1BoxedString](#singledependency1boxedstring)
boxed class to store validated String payloads | +| record | [SingleDependency.SingleDependency1BoxedList](#singledependency1boxedlist)
boxed class to store validated List payloads | +| record | [SingleDependency.SingleDependency1BoxedMap](#singledependency1boxedmap)
boxed class to store validated Map payloads | +| static class | [SingleDependency.SingleDependency1](#singledependency1)
schema class | + +## SingleDependency1Boxed +sealed interface SingleDependency1Boxed
+permits
+[SingleDependency1BoxedVoid](#singledependency1boxedvoid), +[SingleDependency1BoxedBoolean](#singledependency1boxedboolean), +[SingleDependency1BoxedNumber](#singledependency1boxednumber), +[SingleDependency1BoxedString](#singledependency1boxedstring), +[SingleDependency1BoxedList](#singledependency1boxedlist), +[SingleDependency1BoxedMap](#singledependency1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## SingleDependency1BoxedVoid +data class SingleDependency1BoxedVoid
+implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## SingleDependency1BoxedBoolean +data class SingleDependency1BoxedBoolean
+implements [SingleDependency1Boxed](#singledependency1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## SingleDependency1BoxedNumber +data class SingleDependency1BoxedNumber
+implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## SingleDependency1BoxedString +data class SingleDependency1BoxedString
+implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## SingleDependency1BoxedList +data class SingleDependency1BoxedList
+implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## SingleDependency1BoxedMap +data class SingleDependency1BoxedMap
+implements [SingleDependency1Boxed](#singledependency1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SingleDependency1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## SingleDependency1 +class SingleDependency1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Map> | dependentRequired = mapOf(
+    Pair(
+        "bar",
+        setOf( +            "foo"
+        ) +    )
+) + | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedString](#singledependency1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedVoid](#singledependency1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedNumber](#singledependency1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedBoolean](#singledependency1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedMap](#singledependency1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [SingleDependency1BoxedList](#singledependency1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [SingleDependency1Boxed](#singledependency1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SmallMultipleOfLargeInteger.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SmallMultipleOfLargeInteger.md new file mode 100644 index 00000000000..4ac3fc21c89 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/SmallMultipleOfLargeInteger.md @@ -0,0 +1,85 @@ +# SmallMultipleOfLargeInteger +org.openapijsonschematools.client.components.schemas.SmallMultipleOfLargeInteger.java +class SmallMultipleOfLargeInteger
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1Boxed](#smallmultipleoflargeinteger1boxed)
sealed interface for validated payloads | +| record | [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1BoxedNumber](#smallmultipleoflargeinteger1boxednumber)
boxed class to store validated Number payloads | +| static class | [SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1](#smallmultipleoflargeinteger1)
schema class | + +## SmallMultipleOfLargeInteger1Boxed +sealed interface SmallMultipleOfLargeInteger1Boxed
+permits
+[SmallMultipleOfLargeInteger1BoxedNumber](#smallmultipleoflargeinteger1boxednumber) + +sealed interface that stores validated payloads using boxed classes + +## SmallMultipleOfLargeInteger1BoxedNumber +data class SmallMultipleOfLargeInteger1BoxedNumber
+implements [SmallMultipleOfLargeInteger1Boxed](#smallmultipleoflargeinteger1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| SmallMultipleOfLargeInteger1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## SmallMultipleOfLargeInteger1 +class SmallMultipleOfLargeInteger1
+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.SmallMultipleOfLargeInteger; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// int validation +int validatedPayload = SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1.validate( + 1L, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java
)
| +| String | type = "int"; | +| BigDecimal | multipleOf = BigDecimal("1.0E-8") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| [SmallMultipleOfLargeInteger1BoxedNumber](#smallmultipleoflargeinteger1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [SmallMultipleOfLargeInteger1Boxed](#smallmultipleoflargeinteger1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md new file mode 100644 index 00000000000..30d0ca293d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/StringTypeMatchesStrings.md @@ -0,0 +1,52 @@ +# StringTypeMatchesStrings +org.openapijsonschematools.client.components.schemas.StringTypeMatchesStrings.java +class StringTypeMatchesStrings
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [StringTypeMatchesStrings.StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed)
sealed interface for validated payloads | +| record | [StringTypeMatchesStrings.StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring)
boxed class to store validated String payloads | +| static class | [StringTypeMatchesStrings.StringTypeMatchesStrings1](#stringtypematchesstrings1)
schema class | + +## StringTypeMatchesStrings1Boxed +sealed interface StringTypeMatchesStrings1Boxed
+permits
+[StringTypeMatchesStrings1BoxedString](#stringtypematchesstrings1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## StringTypeMatchesStrings1BoxedString +data class StringTypeMatchesStrings1BoxedString
+implements [StringTypeMatchesStrings1Boxed](#stringtypematchesstrings1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| StringTypeMatchesStrings1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## StringTypeMatchesStrings1 +class StringTypeMatchesStrings1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TimeFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TimeFormat.md new file mode 100644 index 00000000000..6c9b0696e11 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TimeFormat.md @@ -0,0 +1,169 @@ +# TimeFormat +org.openapijsonschematools.client.components.schemas.TimeFormat.java +class TimeFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TimeFormat.TimeFormat1Boxed](#timeformat1boxed)
sealed interface for validated payloads | +| record | [TimeFormat.TimeFormat1BoxedVoid](#timeformat1boxedvoid)
boxed class to store validated null payloads | +| record | [TimeFormat.TimeFormat1BoxedBoolean](#timeformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [TimeFormat.TimeFormat1BoxedNumber](#timeformat1boxednumber)
boxed class to store validated Number payloads | +| record | [TimeFormat.TimeFormat1BoxedString](#timeformat1boxedstring)
boxed class to store validated String payloads | +| record | [TimeFormat.TimeFormat1BoxedList](#timeformat1boxedlist)
boxed class to store validated List payloads | +| record | [TimeFormat.TimeFormat1BoxedMap](#timeformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [TimeFormat.TimeFormat1](#timeformat1)
schema class | + +## TimeFormat1Boxed +sealed interface TimeFormat1Boxed
+permits
+[TimeFormat1BoxedVoid](#timeformat1boxedvoid), +[TimeFormat1BoxedBoolean](#timeformat1boxedboolean), +[TimeFormat1BoxedNumber](#timeformat1boxednumber), +[TimeFormat1BoxedString](#timeformat1boxedstring), +[TimeFormat1BoxedList](#timeformat1boxedlist), +[TimeFormat1BoxedMap](#timeformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## TimeFormat1BoxedVoid +data class TimeFormat1BoxedVoid
+implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## TimeFormat1BoxedBoolean +data class TimeFormat1BoxedBoolean
+implements [TimeFormat1Boxed](#timeformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## TimeFormat1BoxedNumber +data class TimeFormat1BoxedNumber
+implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## TimeFormat1BoxedString +data class TimeFormat1BoxedString
+implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## TimeFormat1BoxedList +data class TimeFormat1BoxedList
+implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## TimeFormat1BoxedMap +data class TimeFormat1BoxedMap
+implements [TimeFormat1Boxed](#timeformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TimeFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## TimeFormat1 +class TimeFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "time"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedString](#timeformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedVoid](#timeformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedNumber](#timeformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedBoolean](#timeformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedMap](#timeformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [TimeFormat1BoxedList](#timeformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [TimeFormat1Boxed](#timeformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayObjectOrNull.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayObjectOrNull.md new file mode 100644 index 00000000000..91459eaefce --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayObjectOrNull.md @@ -0,0 +1,125 @@ +# TypeArrayObjectOrNull +org.openapijsonschematools.client.components.schemas.TypeArrayObjectOrNull.java +class TypeArrayObjectOrNull
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed)
sealed interface for validated payloads | +| record | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1BoxedList](#typearrayobjectornull1boxedlist)
boxed class to store validated List payloads | +| record | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1BoxedMap](#typearrayobjectornull1boxedmap)
boxed class to store validated Map payloads | +| record | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1BoxedVoid](#typearrayobjectornull1boxedvoid)
boxed class to store validated null payloads | +| static class | [TypeArrayObjectOrNull.TypeArrayObjectOrNull1](#typearrayobjectornull1)
schema class | + +## TypeArrayObjectOrNull1Boxed +sealed interface TypeArrayObjectOrNull1Boxed
+permits
+[TypeArrayObjectOrNull1BoxedList](#typearrayobjectornull1boxedlist), +[TypeArrayObjectOrNull1BoxedMap](#typearrayobjectornull1boxedmap), +[TypeArrayObjectOrNull1BoxedVoid](#typearrayobjectornull1boxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## TypeArrayObjectOrNull1BoxedList +data class TypeArrayObjectOrNull1BoxedList
+implements [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayObjectOrNull1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## TypeArrayObjectOrNull1BoxedMap +data class TypeArrayObjectOrNull1BoxedMap
+implements [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayObjectOrNull1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## TypeArrayObjectOrNull1BoxedVoid +data class TypeArrayObjectOrNull1BoxedVoid
+implements [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayObjectOrNull1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## TypeArrayObjectOrNull1 +class TypeArrayObjectOrNull1
+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.TypeArrayObjectOrNull; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// null validation +Nothing? validatedPayload = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.validate( + null, + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    List::class.java,
    Map::class.java,
    Void::class.java
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1BoxedList](#typearrayobjectornull1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1BoxedMap](#typearrayobjectornull1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1BoxedVoid](#typearrayobjectornull1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [TypeArrayObjectOrNull1Boxed](#typearrayobjectornull1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayOrObject.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayOrObject.md new file mode 100644 index 00000000000..04442787c75 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeArrayOrObject.md @@ -0,0 +1,81 @@ +# TypeArrayOrObject +org.openapijsonschematools.client.components.schemas.TypeArrayOrObject.java +class TypeArrayOrObject
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TypeArrayOrObject.TypeArrayOrObject1Boxed](#typearrayorobject1boxed)
sealed interface for validated payloads | +| record | [TypeArrayOrObject.TypeArrayOrObject1BoxedList](#typearrayorobject1boxedlist)
boxed class to store validated List payloads | +| record | [TypeArrayOrObject.TypeArrayOrObject1BoxedMap](#typearrayorobject1boxedmap)
boxed class to store validated Map payloads | +| static class | [TypeArrayOrObject.TypeArrayOrObject1](#typearrayorobject1)
schema class | + +## TypeArrayOrObject1Boxed +sealed interface TypeArrayOrObject1Boxed
+permits
+[TypeArrayOrObject1BoxedList](#typearrayorobject1boxedlist), +[TypeArrayOrObject1BoxedMap](#typearrayorobject1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## TypeArrayOrObject1BoxedList +data class TypeArrayOrObject1BoxedList
+implements [TypeArrayOrObject1Boxed](#typearrayorobject1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayOrObject1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## TypeArrayOrObject1BoxedMap +data class TypeArrayOrObject1BoxedMap
+implements [TypeArrayOrObject1Boxed](#typearrayorobject1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeArrayOrObject1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## TypeArrayOrObject1 +class TypeArrayOrObject1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    List::class.java,
    Map::class.java
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [TypeArrayOrObject1BoxedList](#typearrayorobject1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [TypeArrayOrObject1BoxedMap](#typearrayorobject1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [TypeArrayOrObject1Boxed](#typearrayorobject1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeAsArrayWithOneItem.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeAsArrayWithOneItem.md new file mode 100644 index 00000000000..8b9ee26252e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/TypeAsArrayWithOneItem.md @@ -0,0 +1,52 @@ +# TypeAsArrayWithOneItem +org.openapijsonschematools.client.components.schemas.TypeAsArrayWithOneItem.java +class TypeAsArrayWithOneItem
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1Boxed](#typeasarraywithoneitem1boxed)
sealed interface for validated payloads | +| record | [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1BoxedString](#typeasarraywithoneitem1boxedstring)
boxed class to store validated String payloads | +| static class | [TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1](#typeasarraywithoneitem1)
schema class | + +## TypeAsArrayWithOneItem1Boxed +sealed interface TypeAsArrayWithOneItem1Boxed
+permits
+[TypeAsArrayWithOneItem1BoxedString](#typeasarraywithoneitem1boxedstring) + +sealed interface that stores validated payloads using boxed classes + +## TypeAsArrayWithOneItem1BoxedString +data class TypeAsArrayWithOneItem1BoxedString
+implements [TypeAsArrayWithOneItem1Boxed](#typeasarraywithoneitem1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| TypeAsArrayWithOneItem1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## TypeAsArrayWithOneItem1 +class TypeAsArrayWithOneItem1
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsAsSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsAsSchema.md new file mode 100644 index 00000000000..8df9cd10550 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsAsSchema.md @@ -0,0 +1,207 @@ +# UnevaluateditemsAsSchema +org.openapijsonschematools.client.components.schemas.UnevaluateditemsAsSchema.java +class UnevaluateditemsAsSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedVoid](#unevaluateditemsasschema1boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedBoolean](#unevaluateditemsasschema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedNumber](#unevaluateditemsasschema1boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedString](#unevaluateditemsasschema1boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedList](#unevaluateditemsasschema1boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1BoxedMap](#unevaluateditemsasschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1](#unevaluateditemsasschema1)
schema class | +| sealed interface | [UnevaluateditemsAsSchema.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsAsSchema.UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring)
boxed class to store validated String payloads | +| static class | [UnevaluateditemsAsSchema.UnevaluatedItems](#unevaluateditems)
schema class | + +## UnevaluateditemsAsSchema1Boxed +sealed interface UnevaluateditemsAsSchema1Boxed
+permits
+[UnevaluateditemsAsSchema1BoxedVoid](#unevaluateditemsasschema1boxedvoid), +[UnevaluateditemsAsSchema1BoxedBoolean](#unevaluateditemsasschema1boxedboolean), +[UnevaluateditemsAsSchema1BoxedNumber](#unevaluateditemsasschema1boxednumber), +[UnevaluateditemsAsSchema1BoxedString](#unevaluateditemsasschema1boxedstring), +[UnevaluateditemsAsSchema1BoxedList](#unevaluateditemsasschema1boxedlist), +[UnevaluateditemsAsSchema1BoxedMap](#unevaluateditemsasschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsAsSchema1BoxedVoid +data class UnevaluateditemsAsSchema1BoxedVoid
+implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsAsSchema1BoxedBoolean +data class UnevaluateditemsAsSchema1BoxedBoolean
+implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsAsSchema1BoxedNumber +data class UnevaluateditemsAsSchema1BoxedNumber
+implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsAsSchema1BoxedString +data class UnevaluateditemsAsSchema1BoxedString
+implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsAsSchema1BoxedList +data class UnevaluateditemsAsSchema1BoxedList
+implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsAsSchema1BoxedMap +data class UnevaluateditemsAsSchema1BoxedMap
+implements [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsAsSchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsAsSchema1 +class UnevaluateditemsAsSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedString](#unevaluateditemsasschema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedVoid](#unevaluateditemsasschema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedNumber](#unevaluateditemsasschema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedBoolean](#unevaluateditemsasschema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedMap](#unevaluateditemsasschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1BoxedList](#unevaluateditemsasschema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsAsSchema1Boxed](#unevaluateditemsasschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
+permits
+[UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedString +data class UnevaluatedItemsBoxedString
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItems +class UnevaluatedItems
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md new file mode 100644 index 00000000000..58946fe9263 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.md @@ -0,0 +1,945 @@ +# UnevaluateditemsDependsOnMultipleNestedContains +org.openapijsonschematools.client.components.schemas.UnevaluateditemsDependsOnMultipleNestedContains.java +class UnevaluateditemsDependsOnMultipleNestedContains
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid](#unevaluateditemsdependsonmultiplenestedcontains1boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean](#unevaluateditemsdependsonmultiplenestedcontains1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber](#unevaluateditemsdependsonmultiplenestedcontains1boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedString](#unevaluateditemsdependsonmultiplenestedcontains1boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedList](#unevaluateditemsdependsonmultiplenestedcontains1boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap](#unevaluateditemsdependsonmultiplenestedcontains1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1](#unevaluateditemsdependsonmultiplenestedcontains1)
schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedBoolean](#unevaluateditemsboxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedNumber](#unevaluateditemsboxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedList](#unevaluateditemsboxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItemsBoxedMap](#unevaluateditemsboxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.UnevaluatedItems](#unevaluateditems)
schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedVoid](#schema1boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedNumber](#schema1boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedString](#schema1boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedList](#schema1boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1BoxedMap](#schema1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Schema1](#schema1)
schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1Boxed](#contains1boxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedVoid](#contains1boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedBoolean](#contains1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedNumber](#contains1boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedString](#contains1boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedList](#contains1boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1BoxedMap](#contains1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Contains1](#contains1)
schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedVoid](#schema0boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedNumber](#schema0boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedString](#schema0boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedList](#schema0boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0BoxedMap](#schema0boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Schema0](#schema0)
schema class | +| sealed interface | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxed](#containsboxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedVoid](#containsboxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedBoolean](#containsboxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedNumber](#containsboxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedString](#containsboxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedList](#containsboxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsDependsOnMultipleNestedContains.ContainsBoxedMap](#containsboxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsDependsOnMultipleNestedContains.Contains](#contains)
schema class | + +## UnevaluateditemsDependsOnMultipleNestedContains1Boxed +sealed interface UnevaluateditemsDependsOnMultipleNestedContains1Boxed
+permits
+[UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid](#unevaluateditemsdependsonmultiplenestedcontains1boxedvoid), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean](#unevaluateditemsdependsonmultiplenestedcontains1boxedboolean), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber](#unevaluateditemsdependsonmultiplenestedcontains1boxednumber), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedString](#unevaluateditemsdependsonmultiplenestedcontains1boxedstring), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedList](#unevaluateditemsdependsonmultiplenestedcontains1boxedlist), +[UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap](#unevaluateditemsdependsonmultiplenestedcontains1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid
+implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean
+implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber
+implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedString +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedString
+implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedList +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedList
+implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap +data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap
+implements [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsDependsOnMultipleNestedContains1 +class UnevaluateditemsDependsOnMultipleNestedContains1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| List> | allOf = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
;)
| +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedString](#unevaluateditemsdependsonmultiplenestedcontains1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid](#unevaluateditemsdependsonmultiplenestedcontains1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber](#unevaluateditemsdependsonmultiplenestedcontains1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean](#unevaluateditemsdependsonmultiplenestedcontains1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap](#unevaluateditemsdependsonmultiplenestedcontains1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1BoxedList](#unevaluateditemsdependsonmultiplenestedcontains1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsDependsOnMultipleNestedContains1Boxed](#unevaluateditemsdependsonmultiplenestedcontains1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
+permits
+[UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid), +[UnevaluatedItemsBoxedBoolean](#unevaluateditemsboxedboolean), +[UnevaluatedItemsBoxedNumber](#unevaluateditemsboxednumber), +[UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring), +[UnevaluatedItemsBoxedList](#unevaluateditemsboxedlist), +[UnevaluatedItemsBoxedMap](#unevaluateditemsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedVoid +data class UnevaluatedItemsBoxedVoid
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItemsBoxedBoolean +data class UnevaluatedItemsBoxedBoolean
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItemsBoxedNumber +data class UnevaluatedItemsBoxedNumber
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItemsBoxedString +data class UnevaluatedItemsBoxedString
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItemsBoxedList +data class UnevaluatedItemsBoxedList
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItemsBoxedMap +data class UnevaluatedItemsBoxedMap
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItems +class UnevaluatedItems
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("5") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedNumber](#unevaluateditemsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedBoolean](#unevaluateditemsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedMap](#unevaluateditemsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxedList](#unevaluateditemsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedItemsBoxed](#unevaluateditemsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedVoid](#schema1boxedvoid), +[Schema1BoxedBoolean](#schema1boxedboolean), +[Schema1BoxedNumber](#schema1boxednumber), +[Schema1BoxedString](#schema1boxedstring), +[Schema1BoxedList](#schema1boxedlist), +[Schema1BoxedMap](#schema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedVoid +data class Schema1BoxedVoid
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedNumber +data class Schema1BoxedNumber
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedString +data class Schema1BoxedString
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedList +data class Schema1BoxedList
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1BoxedMap +data class Schema1BoxedMap
+implements [Schema1Boxed](#schema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains1::class.java](#contains1) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema1BoxedString](#schema1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema1BoxedVoid](#schema1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema1BoxedNumber](#schema1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema1BoxedBoolean](#schema1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema1BoxedMap](#schema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema1BoxedList](#schema1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema1Boxed](#schema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Contains1Boxed +sealed interface Contains1Boxed
+permits
+[Contains1BoxedVoid](#contains1boxedvoid), +[Contains1BoxedBoolean](#contains1boxedboolean), +[Contains1BoxedNumber](#contains1boxednumber), +[Contains1BoxedString](#contains1boxedstring), +[Contains1BoxedList](#contains1boxedlist), +[Contains1BoxedMap](#contains1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Contains1BoxedVoid +data class Contains1BoxedVoid
+implements [Contains1Boxed](#contains1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains1BoxedBoolean +data class Contains1BoxedBoolean
+implements [Contains1Boxed](#contains1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains1BoxedNumber +data class Contains1BoxedNumber
+implements [Contains1Boxed](#contains1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains1BoxedString +data class Contains1BoxedString
+implements [Contains1Boxed](#contains1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains1BoxedList +data class Contains1BoxedList
+implements [Contains1Boxed](#contains1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains1BoxedMap +data class Contains1BoxedMap
+implements [Contains1Boxed](#contains1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Contains1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains1 +class Contains1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("3") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Contains1BoxedString](#contains1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Contains1BoxedVoid](#contains1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Contains1BoxedNumber](#contains1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Contains1BoxedBoolean](#contains1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Contains1BoxedMap](#contains1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Contains1BoxedList](#contains1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Contains1Boxed](#contains1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedVoid](#schema0boxedvoid), +[Schema0BoxedBoolean](#schema0boxedboolean), +[Schema0BoxedNumber](#schema0boxednumber), +[Schema0BoxedString](#schema0boxedstring), +[Schema0BoxedList](#schema0boxedlist), +[Schema0BoxedMap](#schema0boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedVoid +data class Schema0BoxedVoid
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedNumber +data class Schema0BoxedNumber
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedString +data class Schema0BoxedString
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedList +data class Schema0BoxedList
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0BoxedMap +data class Schema0BoxedMap
+implements [Schema0Boxed](#schema0boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | contains = [Contains::class.java](#contains) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [Schema0BoxedString](#schema0boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [Schema0BoxedVoid](#schema0boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [Schema0BoxedNumber](#schema0boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [Schema0BoxedBoolean](#schema0boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [Schema0BoxedMap](#schema0boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [Schema0BoxedList](#schema0boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [Schema0Boxed](#schema0boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ContainsBoxed +sealed interface ContainsBoxed
+permits
+[ContainsBoxedVoid](#containsboxedvoid), +[ContainsBoxedBoolean](#containsboxedboolean), +[ContainsBoxedNumber](#containsboxednumber), +[ContainsBoxedString](#containsboxedstring), +[ContainsBoxedList](#containsboxedlist), +[ContainsBoxedMap](#containsboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ContainsBoxedVoid +data class ContainsBoxedVoid
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedBoolean +data class ContainsBoxedBoolean
+implements [ContainsBoxed](#containsboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedNumber +data class ContainsBoxedNumber
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedString +data class ContainsBoxedString
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedList +data class ContainsBoxedList
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ContainsBoxedMap +data class ContainsBoxedMap
+implements [ContainsBoxed](#containsboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ContainsBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Contains +class Contains
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxedString](#containsboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ContainsBoxedVoid](#containsboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ContainsBoxedNumber](#containsboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ContainsBoxedBoolean](#containsboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ContainsBoxedMap](#containsboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ContainsBoxedList](#containsboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ContainsBoxed](#containsboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithItems.md new file mode 100644 index 00000000000..70c4884ae7a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithItems.md @@ -0,0 +1,201 @@ +# UnevaluateditemsWithItems +org.openapijsonschematools.client.components.schemas.UnevaluateditemsWithItems.java +class UnevaluateditemsWithItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [UnevaluateditemsWithItems.UnevaluateditemsWithItems1Boxed](#unevaluateditemswithitems1boxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsWithItems.UnevaluateditemsWithItems1BoxedList](#unevaluateditemswithitems1boxedlist)
boxed class to store validated List payloads | +| static class | [UnevaluateditemsWithItems.UnevaluateditemsWithItems1](#unevaluateditemswithitems1)
schema class | +| sealed interface | [UnevaluateditemsWithItems.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsWithItems.UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring)
boxed class to store validated String payloads | +| static class | [UnevaluateditemsWithItems.UnevaluatedItems](#unevaluateditems)
schema class | +| static class | [UnevaluateditemsWithItems.UnevaluateditemsWithItemsListBuilder](#unevaluateditemswithitemslistbuilder)
builder for List payloads | +| static class | [UnevaluateditemsWithItems.UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist)
output class for List payloads | +| sealed interface | [UnevaluateditemsWithItems.ItemsBoxed](#itemsboxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsWithItems.ItemsBoxedNumber](#itemsboxednumber)
boxed class to store validated Number payloads | +| static class | [UnevaluateditemsWithItems.Items](#items)
schema class | + +## UnevaluateditemsWithItems1Boxed +sealed interface UnevaluateditemsWithItems1Boxed
+permits
+[UnevaluateditemsWithItems1BoxedList](#unevaluateditemswithitems1boxedlist) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsWithItems1BoxedList +data class UnevaluateditemsWithItems1BoxedList
+implements [UnevaluateditemsWithItems1Boxed](#unevaluateditemswithitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithItems1BoxedList([UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsWithItems1 +class UnevaluateditemsWithItems1
+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.UnevaluateditemsWithItems; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// List validation +UnevaluateditemsWithItems.UnevaluateditemsWithItemsList validatedPayload = + UnevaluateditemsWithItems.UnevaluateditemsWithItems1.validate( + new UnevaluateditemsWithItems.UnevaluateditemsWithItemsListBuilder() + .add(1) + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(List::class.java) | +| Class | items = [Items::class.java](#items) | +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) | validate(arg: [List<*>](#unevaluateditemswithitemslistbuilder), configuration: SchemaConfiguration) | +| [UnevaluateditemsWithItems1BoxedList](#unevaluateditemswithitems1boxedlist) | validateAndBox([List<*>](#unevaluateditemswithitemslistbuilder), configuration: SchemaConfiguration) | +| [UnevaluateditemsWithItems1Boxed](#unevaluateditemswithitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
+permits
+[UnevaluatedItemsBoxedString](#unevaluateditemsboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedString +data class UnevaluatedItemsBoxedString
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItems +class UnevaluatedItems
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UnevaluateditemsWithItemsListBuilder +class UnevaluateditemsWithItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithItemsListBuilder()
Creates an empty list | +| UnevaluateditemsWithItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| UnevaluateditemsWithItemsListBuilder | add(item: Int) | +| UnevaluateditemsWithItemsListBuilder | add(item: Float) | +| UnevaluateditemsWithItemsListBuilder | add(item: Long) | +| UnevaluateditemsWithItemsListBuilder | add(item: Double) | +| List | build()
Returns list input that should be used with Schema.validate | + +## UnevaluateditemsWithItemsList +class UnevaluateditemsWithItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UnevaluateditemsWithItemsList](#unevaluateditemswithitemslist) | of([List](#unevaluateditemswithitemslistbuilder) arg, SchemaConfiguration configuration) | + +## ItemsBoxed +sealed interface ItemsBoxed
+permits
+[ItemsBoxedNumber](#itemsboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## ItemsBoxedNumber +data class ItemsBoxedNumber
+implements [ItemsBoxed](#itemsboxed) + +data class 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 | +| Any? | getData()
validated payload | + +## Items +class Items
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md new file mode 100644 index 00000000000..e2c1ce930f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluateditemsWithNullInstanceElements.md @@ -0,0 +1,207 @@ +# UnevaluateditemsWithNullInstanceElements +org.openapijsonschematools.client.components.schemas.UnevaluateditemsWithNullInstanceElements.java +class UnevaluateditemsWithNullInstanceElements
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedVoid](#unevaluateditemswithnullinstanceelements1boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedBoolean](#unevaluateditemswithnullinstanceelements1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedNumber](#unevaluateditemswithnullinstanceelements1boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedString](#unevaluateditemswithnullinstanceelements1boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedList](#unevaluateditemswithnullinstanceelements1boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1BoxedMap](#unevaluateditemswithnullinstanceelements1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1](#unevaluateditemswithnullinstanceelements1)
schema class | +| sealed interface | [UnevaluateditemsWithNullInstanceElements.UnevaluatedItemsBoxed](#unevaluateditemsboxed)
sealed interface for validated payloads | +| record | [UnevaluateditemsWithNullInstanceElements.UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid)
boxed class to store validated null payloads | +| static class | [UnevaluateditemsWithNullInstanceElements.UnevaluatedItems](#unevaluateditems)
schema class | + +## UnevaluateditemsWithNullInstanceElements1Boxed +sealed interface UnevaluateditemsWithNullInstanceElements1Boxed
+permits
+[UnevaluateditemsWithNullInstanceElements1BoxedVoid](#unevaluateditemswithnullinstanceelements1boxedvoid), +[UnevaluateditemsWithNullInstanceElements1BoxedBoolean](#unevaluateditemswithnullinstanceelements1boxedboolean), +[UnevaluateditemsWithNullInstanceElements1BoxedNumber](#unevaluateditemswithnullinstanceelements1boxednumber), +[UnevaluateditemsWithNullInstanceElements1BoxedString](#unevaluateditemswithnullinstanceelements1boxedstring), +[UnevaluateditemsWithNullInstanceElements1BoxedList](#unevaluateditemswithnullinstanceelements1boxedlist), +[UnevaluateditemsWithNullInstanceElements1BoxedMap](#unevaluateditemswithnullinstanceelements1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluateditemsWithNullInstanceElements1BoxedVoid +data class UnevaluateditemsWithNullInstanceElements1BoxedVoid
+implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedBoolean +data class UnevaluateditemsWithNullInstanceElements1BoxedBoolean
+implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedNumber +data class UnevaluateditemsWithNullInstanceElements1BoxedNumber
+implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedString +data class UnevaluateditemsWithNullInstanceElements1BoxedString
+implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedList +data class UnevaluateditemsWithNullInstanceElements1BoxedList
+implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsWithNullInstanceElements1BoxedMap +data class UnevaluateditemsWithNullInstanceElements1BoxedMap
+implements [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluateditemsWithNullInstanceElements1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluateditemsWithNullInstanceElements1 +class UnevaluateditemsWithNullInstanceElements1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | unevaluatedItems = [UnevaluatedItems::class.java](#unevaluateditems) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedString](#unevaluateditemswithnullinstanceelements1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedVoid](#unevaluateditemswithnullinstanceelements1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedNumber](#unevaluateditemswithnullinstanceelements1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedBoolean](#unevaluateditemswithnullinstanceelements1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedMap](#unevaluateditemswithnullinstanceelements1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1BoxedList](#unevaluateditemswithnullinstanceelements1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluateditemsWithNullInstanceElements1Boxed](#unevaluateditemswithnullinstanceelements1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedItemsBoxed +sealed interface UnevaluatedItemsBoxed
+permits
+[UnevaluatedItemsBoxedVoid](#unevaluateditemsboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedItemsBoxedVoid +data class UnevaluatedItemsBoxedVoid
+implements [UnevaluatedItemsBoxed](#unevaluateditemsboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedItemsBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedItems +class UnevaluatedItems
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md new file mode 100644 index 00000000000..b9ad4fec267 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.md @@ -0,0 +1,278 @@ +# UnevaluatedpropertiesNotAffectedByPropertynames +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesNotAffectedByPropertynames.java +class UnevaluatedpropertiesNotAffectedByPropertynames
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid](#unevaluatedpropertiesnotaffectedbypropertynames1boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean](#unevaluatedpropertiesnotaffectedbypropertynames1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber](#unevaluatedpropertiesnotaffectedbypropertynames1boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString](#unevaluatedpropertiesnotaffectedbypropertynames1boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList](#unevaluatedpropertiesnotaffectedbypropertynames1boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap](#unevaluatedpropertiesnotaffectedbypropertynames1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1](#unevaluatedpropertiesnotaffectedbypropertynames1)
schema class | +| sealed interface | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber)
boxed class to store validated Number payloads | +| static class | [UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedProperties](#unevaluatedproperties)
schema class | +| sealed interface | [UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNamesBoxed](#propertynamesboxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNamesBoxedString](#propertynamesboxedstring)
boxed class to store validated String payloads | +| static class | [UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNames](#propertynames)
schema class | + +## UnevaluatedpropertiesNotAffectedByPropertynames1Boxed +sealed interface UnevaluatedpropertiesNotAffectedByPropertynames1Boxed
+permits
+[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid](#unevaluatedpropertiesnotaffectedbypropertynames1boxedvoid), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean](#unevaluatedpropertiesnotaffectedbypropertynames1boxedboolean), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber](#unevaluatedpropertiesnotaffectedbypropertynames1boxednumber), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString](#unevaluatedpropertiesnotaffectedbypropertynames1boxedstring), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList](#unevaluatedpropertiesnotaffectedbypropertynames1boxedlist), +[UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap](#unevaluatedpropertiesnotaffectedbypropertynames1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid
+implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean
+implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber
+implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString
+implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList
+implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap +data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap
+implements [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesNotAffectedByPropertynames1 +class UnevaluatedpropertiesNotAffectedByPropertynames1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | propertyNames = [PropertyNames::class.java](#propertynames) | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString](#unevaluatedpropertiesnotaffectedbypropertynames1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid](#unevaluatedpropertiesnotaffectedbypropertynames1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber](#unevaluatedpropertiesnotaffectedbypropertynames1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean](#unevaluatedpropertiesnotaffectedbypropertynames1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap](#unevaluatedpropertiesnotaffectedbypropertynames1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList](#unevaluatedpropertiesnotaffectedbypropertynames1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesNotAffectedByPropertynames1Boxed](#unevaluatedpropertiesnotaffectedbypropertynames1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
+permits
+[UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedNumber +data class UnevaluatedPropertiesBoxedNumber
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
+extends NumberJsonSchema.NumberJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## PropertyNamesBoxed +sealed interface PropertyNamesBoxed
+permits
+[PropertyNamesBoxedString](#propertynamesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## PropertyNamesBoxedString +data class PropertyNamesBoxedString
+implements [PropertyNamesBoxed](#propertynamesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| PropertyNamesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## PropertyNames +class PropertyNames
+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.UnevaluatedpropertiesNotAffectedByPropertynames; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = UnevaluatedpropertiesNotAffectedByPropertynames.PropertyNames.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Integer | maxLength = 1 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxedString](#propertynamesboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [PropertyNamesBoxed](#propertynamesboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesSchema.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesSchema.md new file mode 100644 index 00000000000..fb7f627b176 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesSchema.md @@ -0,0 +1,131 @@ +# UnevaluatedpropertiesSchema +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesSchema.java +class UnevaluatedpropertiesSchema
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1Boxed](#unevaluatedpropertiesschema1boxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1BoxedMap](#unevaluatedpropertiesschema1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1](#unevaluatedpropertiesschema1)
schema class | +| sealed interface | [UnevaluatedpropertiesSchema.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesSchema.UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring)
boxed class to store validated String payloads | +| static class | [UnevaluatedpropertiesSchema.UnevaluatedProperties](#unevaluatedproperties)
schema class | + +## UnevaluatedpropertiesSchema1Boxed +sealed interface UnevaluatedpropertiesSchema1Boxed
+permits
+[UnevaluatedpropertiesSchema1BoxedMap](#unevaluatedpropertiesschema1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesSchema1BoxedMap +data class UnevaluatedpropertiesSchema1BoxedMap
+implements [UnevaluatedpropertiesSchema1Boxed](#unevaluatedpropertiesschema1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesSchema1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesSchema1 +class UnevaluatedpropertiesSchema1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesSchema1BoxedMap](#unevaluatedpropertiesschema1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesSchema1Boxed](#unevaluatedpropertiesschema1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
+permits
+[UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedString +data class UnevaluatedPropertiesBoxedString
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
+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.UnevaluatedpropertiesSchema; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// String validation +String validatedPayload = UnevaluatedpropertiesSchema.UnevaluatedProperties.validate( + "a", + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(
    String::class.java
)
| +| Integer | minLength = 3 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| [UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md new file mode 100644 index 00000000000..b2d9b45c536 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.md @@ -0,0 +1,437 @@ +# UnevaluatedpropertiesWithAdjacentAdditionalproperties +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesWithAdjacentAdditionalproperties.java +class UnevaluatedpropertiesWithAdjacentAdditionalproperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed](#unevaluatedpropertieswithadjacentadditionalproperties1boxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap](#unevaluatedpropertieswithadjacentadditionalproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1](#unevaluatedpropertieswithadjacentadditionalproperties1)
schema class | +| sealed interface | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedBoolean](#unevaluatedpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedList](#unevaluatedpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedPropertiesBoxedMap](#unevaluatedpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedProperties](#unevaluatedproperties)
schema class | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder)
builder for Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap)
output class for Map payloads | +| sealed interface | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.FooBoxed](#fooboxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.FooBoxedString](#fooboxedstring)
boxed class to store validated String payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.Foo](#foo)
schema class | +| sealed interface | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxed](#additionalpropertiesboxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring)
boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist)
boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithAdjacentAdditionalproperties.AdditionalProperties](#additionalproperties)
schema class | + +## UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed +sealed interface UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed
+permits
+[UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap](#unevaluatedpropertieswithadjacentadditionalproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap +data class UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap
+implements [UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed](#unevaluatedpropertieswithadjacentadditionalproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap([UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesWithAdjacentAdditionalproperties1 +class UnevaluatedpropertiesWithAdjacentAdditionalproperties1
+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.UnevaluatedpropertiesWithAdjacentAdditionalproperties; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + +// Map validation +UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap validatedPayload = + UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.validate( + new UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder() + .foo("a") + + .build(), + configuration +); +``` + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Set> | type = setOf(Map::class.java) | +| Map> | properties = mapOf(
    "foo" to [Foo::class.java](#foo))
)
| +| Class | additionalProperties = [AdditionalProperties::class.java](#additionalproperties) | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) | validate(arg: [Map<?, ?>](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap](#unevaluatedpropertieswithadjacentadditionalproperties1boxedmap) | validateAndBox([Map<?, ?>](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder), configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed](#unevaluatedpropertieswithadjacentadditionalproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
+permits
+[UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid), +[UnevaluatedPropertiesBoxedBoolean](#unevaluatedpropertiesboxedboolean), +[UnevaluatedPropertiesBoxedNumber](#unevaluatedpropertiesboxednumber), +[UnevaluatedPropertiesBoxedString](#unevaluatedpropertiesboxedstring), +[UnevaluatedPropertiesBoxedList](#unevaluatedpropertiesboxedlist), +[UnevaluatedPropertiesBoxedMap](#unevaluatedpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedVoid +data class UnevaluatedPropertiesBoxedVoid
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedPropertiesBoxedBoolean +data class UnevaluatedPropertiesBoxedBoolean
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedPropertiesBoxedNumber +data class UnevaluatedPropertiesBoxedNumber
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedPropertiesBoxedString +data class UnevaluatedPropertiesBoxedString
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedPropertiesBoxedList +data class UnevaluatedPropertiesBoxedList
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedPropertiesBoxedMap +data class UnevaluatedPropertiesBoxedMap
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
+extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder +class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder
+builder for `Map` + +A class that builds the Map input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder()
Creates a builder that contains an empty map | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | build()
Returns map input that should be used with Schema.validate | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | foo(value: String) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Nothing?) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Boolean) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: String) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Int) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Float) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Long) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Double) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: List) | +| [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) | additionalProperty(key: String, value: Map) | + +## UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap +class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap
+extends FrozenMap + +A class to store validated Map payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap](#unevaluatedpropertieswithadjacentadditionalpropertiesmap) | of([Map](#unevaluatedpropertieswithadjacentadditionalpropertiesmapbuilder) arg, SchemaConfiguration configuration) | +| String | foo()
[optional] | +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + +## FooBoxed +sealed interface FooBoxed
+permits
+[FooBoxedString](#fooboxedstring) + +sealed interface that stores validated payloads using boxed classes + +## FooBoxedString +data class FooBoxedString
+implements [FooBoxed](#fooboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| FooBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## Foo +class Foo
+extends StringJsonSchema.StringJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## AdditionalPropertiesBoxed +sealed interface AdditionalPropertiesBoxed
+permits
+[AdditionalPropertiesBoxedVoid](#additionalpropertiesboxedvoid), +[AdditionalPropertiesBoxedBoolean](#additionalpropertiesboxedboolean), +[AdditionalPropertiesBoxedNumber](#additionalpropertiesboxednumber), +[AdditionalPropertiesBoxedString](#additionalpropertiesboxedstring), +[AdditionalPropertiesBoxedList](#additionalpropertiesboxedlist), +[AdditionalPropertiesBoxedMap](#additionalpropertiesboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## AdditionalPropertiesBoxedVoid +data class AdditionalPropertiesBoxedVoid
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedBoolean +data class AdditionalPropertiesBoxedBoolean
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedNumber +data class AdditionalPropertiesBoxedNumber
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedString +data class AdditionalPropertiesBoxedString
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedList +data class AdditionalPropertiesBoxedList
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalPropertiesBoxedMap +data class AdditionalPropertiesBoxedMap
+implements [AdditionalPropertiesBoxed](#additionalpropertiesboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| AdditionalPropertiesBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## AdditionalProperties +class AdditionalProperties
+extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md new file mode 100644 index 00000000000..af90c453785 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.md @@ -0,0 +1,207 @@ +# UnevaluatedpropertiesWithNullValuedInstanceProperties +org.openapijsonschematools.client.components.schemas.UnevaluatedpropertiesWithNullValuedInstanceProperties.java +class UnevaluatedpropertiesWithNullValuedInstanceProperties
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedvoid)
boxed class to store validated null payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxednumber)
boxed class to store validated Number payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedstring)
boxed class to store validated String payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedlist)
boxed class to store validated List payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedmap)
boxed class to store validated Map payloads | +| static class | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1](#unevaluatedpropertieswithnullvaluedinstanceproperties1)
schema class | +| sealed interface | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed)
sealed interface for validated payloads | +| record | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid)
boxed class to store validated null payloads | +| static class | [UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedProperties](#unevaluatedproperties)
schema class | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed +sealed interface UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed
+permits
+[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedvoid), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedboolean), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxednumber), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedstring), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedlist), +[UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid
+implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean
+implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber
+implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString
+implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList
+implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap +data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap
+implements [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedpropertiesWithNullValuedInstanceProperties1 +class UnevaluatedpropertiesWithNullValuedInstanceProperties1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | unevaluatedProperties = [UnevaluatedProperties::class.java](#unevaluatedproperties) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed](#unevaluatedpropertieswithnullvaluedinstanceproperties1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## UnevaluatedPropertiesBoxed +sealed interface UnevaluatedPropertiesBoxed
+permits
+[UnevaluatedPropertiesBoxedVoid](#unevaluatedpropertiesboxedvoid) + +sealed interface that stores validated payloads using boxed classes + +## UnevaluatedPropertiesBoxedVoid +data class UnevaluatedPropertiesBoxedVoid
+implements [UnevaluatedPropertiesBoxed](#unevaluatedpropertiesboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UnevaluatedPropertiesBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UnevaluatedProperties +class UnevaluatedProperties
+extends NullJsonSchema.NullJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.NullJsonSchema.NullJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md new file mode 100644 index 00000000000..5529c997fa9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsFalseValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsFalseValidation.java +class UniqueitemsFalseValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsFalseValidation.UniqueitemsFalseValidation1](#uniqueitemsfalsevalidation1)
schema class | + +## UniqueitemsFalseValidation1Boxed +sealed interface UniqueitemsFalseValidation1Boxed
+permits
+[UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid), +[UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean), +[UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber), +[UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring), +[UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist), +[UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsFalseValidation1BoxedVoid +data class UniqueitemsFalseValidation1BoxedVoid
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedBoolean +data class UniqueitemsFalseValidation1BoxedBoolean
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedNumber +data class UniqueitemsFalseValidation1BoxedNumber
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedString +data class UniqueitemsFalseValidation1BoxedString
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedList +data class UniqueitemsFalseValidation1BoxedList
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1BoxedMap +data class UniqueitemsFalseValidation1BoxedMap
+implements [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseValidation1 +class UniqueitemsFalseValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = false | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedString](#uniqueitemsfalsevalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedVoid](#uniqueitemsfalsevalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedNumber](#uniqueitemsfalsevalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedBoolean](#uniqueitemsfalsevalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedMap](#uniqueitemsfalsevalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1BoxedList](#uniqueitemsfalsevalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseValidation1Boxed](#uniqueitemsfalsevalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md new file mode 100644 index 00000000000..c7a9935f3a6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsFalseWithAnArrayOfItems.md @@ -0,0 +1,287 @@ +# UniqueitemsFalseWithAnArrayOfItems +org.openapijsonschematools.client.components.schemas.UniqueitemsFalseWithAnArrayOfItems.java +class UniqueitemsFalseWithAnArrayOfItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedVoid](#uniqueitemsfalsewithanarrayofitems1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean](#uniqueitemsfalsewithanarrayofitems1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedNumber](#uniqueitemsfalsewithanarrayofitems1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedString](#uniqueitemsfalsewithanarrayofitems1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedList](#uniqueitemsfalsewithanarrayofitems1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1BoxedMap](#uniqueitemsfalsewithanarrayofitems1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1](#uniqueitemsfalsewithanarrayofitems1)
schema class | +| sealed interface | [UniqueitemsFalseWithAnArrayOfItems.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.Schema1](#schema1)
schema class | +| sealed interface | [UniqueitemsFalseWithAnArrayOfItems.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [UniqueitemsFalseWithAnArrayOfItems.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.Schema0](#schema0)
schema class | +| static class | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder](#uniqueitemsfalsewithanarrayofitemslistbuilder)
builder for List payloads | +| static class | [UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist)
output class for List payloads | + +## UniqueitemsFalseWithAnArrayOfItems1Boxed +sealed interface UniqueitemsFalseWithAnArrayOfItems1Boxed
+permits
+[UniqueitemsFalseWithAnArrayOfItems1BoxedVoid](#uniqueitemsfalsewithanarrayofitems1boxedvoid), +[UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean](#uniqueitemsfalsewithanarrayofitems1boxedboolean), +[UniqueitemsFalseWithAnArrayOfItems1BoxedNumber](#uniqueitemsfalsewithanarrayofitems1boxednumber), +[UniqueitemsFalseWithAnArrayOfItems1BoxedString](#uniqueitemsfalsewithanarrayofitems1boxedstring), +[UniqueitemsFalseWithAnArrayOfItems1BoxedList](#uniqueitemsfalsewithanarrayofitems1boxedlist), +[UniqueitemsFalseWithAnArrayOfItems1BoxedMap](#uniqueitemsfalsewithanarrayofitems1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsFalseWithAnArrayOfItems1BoxedVoid +data class UniqueitemsFalseWithAnArrayOfItems1BoxedVoid
+implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean +data class UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean
+implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedNumber +data class UniqueitemsFalseWithAnArrayOfItems1BoxedNumber
+implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedString +data class UniqueitemsFalseWithAnArrayOfItems1BoxedString
+implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedList +data class UniqueitemsFalseWithAnArrayOfItems1BoxedList
+implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedList([UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1BoxedMap +data class UniqueitemsFalseWithAnArrayOfItems1BoxedMap
+implements [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItems1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsFalseWithAnArrayOfItems1 +class UniqueitemsFalseWithAnArrayOfItems1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = false | +| List> | prefixItems = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) | validate(arg: [List<*>](#uniqueitemsfalsewithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedString](#uniqueitemsfalsewithanarrayofitems1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedVoid](#uniqueitemsfalsewithanarrayofitems1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedNumber](#uniqueitemsfalsewithanarrayofitems1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean](#uniqueitemsfalsewithanarrayofitems1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedMap](#uniqueitemsfalsewithanarrayofitems1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1BoxedList](#uniqueitemsfalsewithanarrayofitems1boxedlist) | validateAndBox([List<*>](#uniqueitemsfalsewithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsFalseWithAnArrayOfItems1Boxed](#uniqueitemsfalsewithanarrayofitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedBoolean](#schema1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedBoolean](#schema0boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UniqueitemsFalseWithAnArrayOfItemsListBuilder +class UniqueitemsFalseWithAnArrayOfItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder()
Creates an empty list | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Nothing?) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Boolean) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: String) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Int) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Float) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Long) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Double) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: List) | +| UniqueitemsFalseWithAnArrayOfItemsListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## UniqueitemsFalseWithAnArrayOfItemsList +class UniqueitemsFalseWithAnArrayOfItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UniqueitemsFalseWithAnArrayOfItemsList](#uniqueitemsfalsewithanarrayofitemslist) | of([List](#uniqueitemsfalsewithanarrayofitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md new file mode 100644 index 00000000000..09861dec784 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsValidation.md @@ -0,0 +1,169 @@ +# UniqueitemsValidation +org.openapijsonschematools.client.components.schemas.UniqueitemsValidation.java +class UniqueitemsValidation
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UniqueitemsValidation.UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsValidation.UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsValidation.UniqueitemsValidation1](#uniqueitemsvalidation1)
schema class | + +## UniqueitemsValidation1Boxed +sealed interface UniqueitemsValidation1Boxed
+permits
+[UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid), +[UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean), +[UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber), +[UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring), +[UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist), +[UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsValidation1BoxedVoid +data class UniqueitemsValidation1BoxedVoid
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedBoolean +data class UniqueitemsValidation1BoxedBoolean
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedNumber +data class UniqueitemsValidation1BoxedNumber
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedString +data class UniqueitemsValidation1BoxedString
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedList +data class UniqueitemsValidation1BoxedList
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1BoxedMap +data class UniqueitemsValidation1BoxedMap
+implements [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsValidation1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsValidation1 +class UniqueitemsValidation1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = true | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedString](#uniqueitemsvalidation1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedVoid](#uniqueitemsvalidation1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedNumber](#uniqueitemsvalidation1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedBoolean](#uniqueitemsvalidation1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedMap](#uniqueitemsvalidation1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1BoxedList](#uniqueitemsvalidation1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UniqueitemsValidation1Boxed](#uniqueitemsvalidation1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsWithAnArrayOfItems.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsWithAnArrayOfItems.md new file mode 100644 index 00000000000..d2397a579af --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UniqueitemsWithAnArrayOfItems.md @@ -0,0 +1,287 @@ +# UniqueitemsWithAnArrayOfItems +org.openapijsonschematools.client.components.schemas.UniqueitemsWithAnArrayOfItems.java +class UniqueitemsWithAnArrayOfItems
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin 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 | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedVoid](#uniqueitemswithanarrayofitems1boxedvoid)
boxed class to store validated null payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedBoolean](#uniqueitemswithanarrayofitems1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedNumber](#uniqueitemswithanarrayofitems1boxednumber)
boxed class to store validated Number payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedString](#uniqueitemswithanarrayofitems1boxedstring)
boxed class to store validated String payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedList](#uniqueitemswithanarrayofitems1boxedlist)
boxed class to store validated List payloads | +| record | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1BoxedMap](#uniqueitemswithanarrayofitems1boxedmap)
boxed class to store validated Map payloads | +| static class | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1](#uniqueitemswithanarrayofitems1)
schema class | +| sealed interface | [UniqueitemsWithAnArrayOfItems.Schema1Boxed](#schema1boxed)
sealed interface for validated payloads | +| record | [UniqueitemsWithAnArrayOfItems.Schema1BoxedBoolean](#schema1boxedboolean)
boxed class to store validated boolean payloads | +| static class | [UniqueitemsWithAnArrayOfItems.Schema1](#schema1)
schema class | +| sealed interface | [UniqueitemsWithAnArrayOfItems.Schema0Boxed](#schema0boxed)
sealed interface for validated payloads | +| record | [UniqueitemsWithAnArrayOfItems.Schema0BoxedBoolean](#schema0boxedboolean)
boxed class to store validated boolean payloads | +| static class | [UniqueitemsWithAnArrayOfItems.Schema0](#schema0)
schema class | +| static class | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder](#uniqueitemswithanarrayofitemslistbuilder)
builder for List payloads | +| static class | [UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist)
output class for List payloads | + +## UniqueitemsWithAnArrayOfItems1Boxed +sealed interface UniqueitemsWithAnArrayOfItems1Boxed
+permits
+[UniqueitemsWithAnArrayOfItems1BoxedVoid](#uniqueitemswithanarrayofitems1boxedvoid), +[UniqueitemsWithAnArrayOfItems1BoxedBoolean](#uniqueitemswithanarrayofitems1boxedboolean), +[UniqueitemsWithAnArrayOfItems1BoxedNumber](#uniqueitemswithanarrayofitems1boxednumber), +[UniqueitemsWithAnArrayOfItems1BoxedString](#uniqueitemswithanarrayofitems1boxedstring), +[UniqueitemsWithAnArrayOfItems1BoxedList](#uniqueitemswithanarrayofitems1boxedlist), +[UniqueitemsWithAnArrayOfItems1BoxedMap](#uniqueitemswithanarrayofitems1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UniqueitemsWithAnArrayOfItems1BoxedVoid +data class UniqueitemsWithAnArrayOfItems1BoxedVoid
+implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedBoolean +data class UniqueitemsWithAnArrayOfItems1BoxedBoolean
+implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedNumber +data class UniqueitemsWithAnArrayOfItems1BoxedNumber
+implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedString +data class UniqueitemsWithAnArrayOfItems1BoxedString
+implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedList +data class UniqueitemsWithAnArrayOfItems1BoxedList
+implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedList([UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| [UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsWithAnArrayOfItems1BoxedMap +data class UniqueitemsWithAnArrayOfItems1BoxedMap
+implements [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItems1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UniqueitemsWithAnArrayOfItems1 +class UniqueitemsWithAnArrayOfItems1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Boolean | uniqueItems = true | +| List> | prefixItems = listOf(
    [Schema0::class.java](#schema0),
    [Schema1::class.java](#schema1)
)
| + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) | validate(arg: [List<*>](#uniqueitemswithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedString](#uniqueitemswithanarrayofitems1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedVoid](#uniqueitemswithanarrayofitems1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedNumber](#uniqueitemswithanarrayofitems1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedBoolean](#uniqueitemswithanarrayofitems1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedMap](#uniqueitemswithanarrayofitems1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1BoxedList](#uniqueitemswithanarrayofitems1boxedlist) | validateAndBox([List<*>](#uniqueitemswithanarrayofitemslistbuilder), configuration: SchemaConfiguration) | +| [UniqueitemsWithAnArrayOfItems1Boxed](#uniqueitemswithanarrayofitems1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## Schema1Boxed +sealed interface Schema1Boxed
+permits
+[Schema1BoxedBoolean](#schema1boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema1BoxedBoolean +data class Schema1BoxedBoolean
+implements [Schema1Boxed](#schema1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema1 +class Schema1
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## Schema0Boxed +sealed interface Schema0Boxed
+permits
+[Schema0BoxedBoolean](#schema0boxedboolean) + +sealed interface that stores validated payloads using boxed classes + +## Schema0BoxedBoolean +data class Schema0BoxedBoolean
+implements [Schema0Boxed](#schema0boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| Schema0BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## Schema0 +class Schema0
+extends BooleanJsonSchema.BooleanJsonSchema1 + +A schema class that validates payloads + +| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | + +## UniqueitemsWithAnArrayOfItemsListBuilder +class UniqueitemsWithAnArrayOfItemsListBuilder
+builder for `List` + +A class that builds the List input type + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UniqueitemsWithAnArrayOfItemsListBuilder()
Creates an empty list | +| UniqueitemsWithAnArrayOfItemsListBuilder(List items)
Stores the items in a list | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Nothing?) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Boolean) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: String) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Int) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Float) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Long) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Double) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: List) | +| UniqueitemsWithAnArrayOfItemsListBuilder | add(item: Map) | +| List | build()
Returns list input that should be used with Schema.validate | + +## UniqueitemsWithAnArrayOfItemsList +class UniqueitemsWithAnArrayOfItemsList
+extends `FrozenList` + +A class to store validated List payloads + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [UniqueitemsWithAnArrayOfItemsList](#uniqueitemswithanarrayofitemslist) | of([List](#uniqueitemswithanarrayofitemslistbuilder) arg, SchemaConfiguration configuration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriFormat.md new file mode 100644 index 00000000000..ee78e984294 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriFormat.md @@ -0,0 +1,169 @@ +# UriFormat +org.openapijsonschematools.client.components.schemas.UriFormat.java +class UriFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriFormat.UriFormat1Boxed](#uriformat1boxed)
sealed interface for validated payloads | +| record | [UriFormat.UriFormat1BoxedVoid](#uriformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriFormat.UriFormat1BoxedBoolean](#uriformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriFormat.UriFormat1BoxedNumber](#uriformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriFormat.UriFormat1BoxedString](#uriformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriFormat.UriFormat1BoxedList](#uriformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriFormat.UriFormat1BoxedMap](#uriformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriFormat.UriFormat1](#uriformat1)
schema class | + +## UriFormat1Boxed +sealed interface UriFormat1Boxed
+permits
+[UriFormat1BoxedVoid](#uriformat1boxedvoid), +[UriFormat1BoxedBoolean](#uriformat1boxedboolean), +[UriFormat1BoxedNumber](#uriformat1boxednumber), +[UriFormat1BoxedString](#uriformat1boxedstring), +[UriFormat1BoxedList](#uriformat1boxedlist), +[UriFormat1BoxedMap](#uriformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriFormat1BoxedVoid +data class UriFormat1BoxedVoid
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedBoolean +data class UriFormat1BoxedBoolean
+implements [UriFormat1Boxed](#uriformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedNumber +data class UriFormat1BoxedNumber
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedString +data class UriFormat1BoxedString
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedList +data class UriFormat1BoxedList
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1BoxedMap +data class UriFormat1BoxedMap
+implements [UriFormat1Boxed](#uriformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriFormat1 +class UriFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedString](#uriformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriFormat1BoxedVoid](#uriformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriFormat1BoxedNumber](#uriformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriFormat1BoxedBoolean](#uriformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriFormat1BoxedMap](#uriformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriFormat1BoxedList](#uriformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriFormat1Boxed](#uriformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md new file mode 100644 index 00000000000..34c794017c3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriReferenceFormat.md @@ -0,0 +1,169 @@ +# UriReferenceFormat +org.openapijsonschematools.client.components.schemas.UriReferenceFormat.java +class UriReferenceFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriReferenceFormat.UriReferenceFormat1Boxed](#urireferenceformat1boxed)
sealed interface for validated payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriReferenceFormat.UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriReferenceFormat.UriReferenceFormat1](#urireferenceformat1)
schema class | + +## UriReferenceFormat1Boxed +sealed interface UriReferenceFormat1Boxed
+permits
+[UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid), +[UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean), +[UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber), +[UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring), +[UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist), +[UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriReferenceFormat1BoxedVoid +data class UriReferenceFormat1BoxedVoid
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedBoolean +data class UriReferenceFormat1BoxedBoolean
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedNumber +data class UriReferenceFormat1BoxedNumber
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedString +data class UriReferenceFormat1BoxedString
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedList +data class UriReferenceFormat1BoxedList
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1BoxedMap +data class UriReferenceFormat1BoxedMap
+implements [UriReferenceFormat1Boxed](#urireferenceformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriReferenceFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriReferenceFormat1 +class UriReferenceFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-reference"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedString](#urireferenceformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedVoid](#urireferenceformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedNumber](#urireferenceformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedBoolean](#urireferenceformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedMap](#urireferenceformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1BoxedList](#urireferenceformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriReferenceFormat1Boxed](#urireferenceformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md new file mode 100644 index 00000000000..1c17c912d35 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UriTemplateFormat.md @@ -0,0 +1,169 @@ +# UriTemplateFormat +org.openapijsonschematools.client.components.schemas.UriTemplateFormat.java +class UriTemplateFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UriTemplateFormat.UriTemplateFormat1Boxed](#uritemplateformat1boxed)
sealed interface for validated payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring)
boxed class to store validated String payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist)
boxed class to store validated List payloads | +| record | [UriTemplateFormat.UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UriTemplateFormat.UriTemplateFormat1](#uritemplateformat1)
schema class | + +## UriTemplateFormat1Boxed +sealed interface UriTemplateFormat1Boxed
+permits
+[UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid), +[UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean), +[UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber), +[UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring), +[UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist), +[UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UriTemplateFormat1BoxedVoid +data class UriTemplateFormat1BoxedVoid
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedBoolean +data class UriTemplateFormat1BoxedBoolean
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedNumber +data class UriTemplateFormat1BoxedNumber
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedString +data class UriTemplateFormat1BoxedString
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedList +data class UriTemplateFormat1BoxedList
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1BoxedMap +data class UriTemplateFormat1BoxedMap
+implements [UriTemplateFormat1Boxed](#uritemplateformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UriTemplateFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UriTemplateFormat1 +class UriTemplateFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uri-template"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedString](#uritemplateformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedVoid](#uritemplateformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedNumber](#uritemplateformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedBoolean](#uritemplateformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedMap](#uritemplateformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1BoxedList](#uritemplateformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UriTemplateFormat1Boxed](#uritemplateformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UuidFormat.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UuidFormat.md new file mode 100644 index 00000000000..b086762957a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/UuidFormat.md @@ -0,0 +1,169 @@ +# UuidFormat +org.openapijsonschematools.client.components.schemas.UuidFormat.java +class UuidFormat
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [UuidFormat.UuidFormat1Boxed](#uuidformat1boxed)
sealed interface for validated payloads | +| record | [UuidFormat.UuidFormat1BoxedVoid](#uuidformat1boxedvoid)
boxed class to store validated null payloads | +| record | [UuidFormat.UuidFormat1BoxedBoolean](#uuidformat1boxedboolean)
boxed class to store validated boolean payloads | +| record | [UuidFormat.UuidFormat1BoxedNumber](#uuidformat1boxednumber)
boxed class to store validated Number payloads | +| record | [UuidFormat.UuidFormat1BoxedString](#uuidformat1boxedstring)
boxed class to store validated String payloads | +| record | [UuidFormat.UuidFormat1BoxedList](#uuidformat1boxedlist)
boxed class to store validated List payloads | +| record | [UuidFormat.UuidFormat1BoxedMap](#uuidformat1boxedmap)
boxed class to store validated Map payloads | +| static class | [UuidFormat.UuidFormat1](#uuidformat1)
schema class | + +## UuidFormat1Boxed +sealed interface UuidFormat1Boxed
+permits
+[UuidFormat1BoxedVoid](#uuidformat1boxedvoid), +[UuidFormat1BoxedBoolean](#uuidformat1boxedboolean), +[UuidFormat1BoxedNumber](#uuidformat1boxednumber), +[UuidFormat1BoxedString](#uuidformat1boxedstring), +[UuidFormat1BoxedList](#uuidformat1boxedlist), +[UuidFormat1BoxedMap](#uuidformat1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## UuidFormat1BoxedVoid +data class UuidFormat1BoxedVoid
+implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## UuidFormat1BoxedBoolean +data class UuidFormat1BoxedBoolean
+implements [UuidFormat1Boxed](#uuidformat1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## UuidFormat1BoxedNumber +data class UuidFormat1BoxedNumber
+implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## UuidFormat1BoxedString +data class UuidFormat1BoxedString
+implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## UuidFormat1BoxedList +data class UuidFormat1BoxedList
+implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## UuidFormat1BoxedMap +data class UuidFormat1BoxedMap
+implements [UuidFormat1Boxed](#uuidformat1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| UuidFormat1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## UuidFormat1 +class UuidFormat1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| String | type = "uuid"; | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedString](#uuidformat1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedVoid](#uuidformat1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedNumber](#uuidformat1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedBoolean](#uuidformat1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedMap](#uuidformat1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [UuidFormat1BoxedList](#uuidformat1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [UuidFormat1Boxed](#uuidformat1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md new file mode 100644 index 00000000000..5331dbedc81 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/components/schemas/ValidateAgainstCorrectBranchThenVsElse.md @@ -0,0 +1,636 @@ +# ValidateAgainstCorrectBranchThenVsElse +org.openapijsonschematools.client.components.schemas.ValidateAgainstCorrectBranchThenVsElse.java +class ValidateAgainstCorrectBranchThenVsElse
+ +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations + +## Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed)
sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedVoid](#validateagainstcorrectbranchthenvselse1boxedvoid)
boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean](#validateagainstcorrectbranchthenvselse1boxedboolean)
boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedNumber](#validateagainstcorrectbranchthenvselse1boxednumber)
boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedString](#validateagainstcorrectbranchthenvselse1boxedstring)
boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedList](#validateagainstcorrectbranchthenvselse1boxedlist)
boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1BoxedMap](#validateagainstcorrectbranchthenvselse1boxedmap)
boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1](#validateagainstcorrectbranchthenvselse1)
schema class | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxed](#thenboxed)
sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedVoid](#thenboxedvoid)
boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedBoolean](#thenboxedboolean)
boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedNumber](#thenboxednumber)
boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedString](#thenboxedstring)
boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedList](#thenboxedlist)
boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ThenBoxedMap](#thenboxedmap)
boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.Then](#then)
schema class | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxed](#ifschemaboxed)
sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedVoid](#ifschemaboxedvoid)
boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedBoolean](#ifschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedNumber](#ifschemaboxednumber)
boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedString](#ifschemaboxedstring)
boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedList](#ifschemaboxedlist)
boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.IfSchemaBoxedMap](#ifschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.IfSchema](#ifschema)
schema class | +| sealed interface | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxed](#elseschemaboxed)
sealed interface for validated payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedVoid](#elseschemaboxedvoid)
boxed class to store validated null payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedBoolean](#elseschemaboxedboolean)
boxed class to store validated boolean payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedNumber](#elseschemaboxednumber)
boxed class to store validated Number payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedString](#elseschemaboxedstring)
boxed class to store validated String payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedList](#elseschemaboxedlist)
boxed class to store validated List payloads | +| record | [ValidateAgainstCorrectBranchThenVsElse.ElseSchemaBoxedMap](#elseschemaboxedmap)
boxed class to store validated Map payloads | +| static class | [ValidateAgainstCorrectBranchThenVsElse.ElseSchema](#elseschema)
schema class | + +## ValidateAgainstCorrectBranchThenVsElse1Boxed +sealed interface ValidateAgainstCorrectBranchThenVsElse1Boxed
+permits
+[ValidateAgainstCorrectBranchThenVsElse1BoxedVoid](#validateagainstcorrectbranchthenvselse1boxedvoid), +[ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean](#validateagainstcorrectbranchthenvselse1boxedboolean), +[ValidateAgainstCorrectBranchThenVsElse1BoxedNumber](#validateagainstcorrectbranchthenvselse1boxednumber), +[ValidateAgainstCorrectBranchThenVsElse1BoxedString](#validateagainstcorrectbranchthenvselse1boxedstring), +[ValidateAgainstCorrectBranchThenVsElse1BoxedList](#validateagainstcorrectbranchthenvselse1boxedlist), +[ValidateAgainstCorrectBranchThenVsElse1BoxedMap](#validateagainstcorrectbranchthenvselse1boxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ValidateAgainstCorrectBranchThenVsElse1BoxedVoid +data class ValidateAgainstCorrectBranchThenVsElse1BoxedVoid
+implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean +data class ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean
+implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedNumber +data class ValidateAgainstCorrectBranchThenVsElse1BoxedNumber
+implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedString +data class ValidateAgainstCorrectBranchThenVsElse1BoxedString
+implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedList +data class ValidateAgainstCorrectBranchThenVsElse1BoxedList
+implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1BoxedMap +data class ValidateAgainstCorrectBranchThenVsElse1BoxedMap
+implements [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ValidateAgainstCorrectBranchThenVsElse1BoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ValidateAgainstCorrectBranchThenVsElse1 +class ValidateAgainstCorrectBranchThenVsElse1
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Class | if = [IfSchema::class.java](#ifschema) | +| Class | then = [Then::class.java](#then) | +| Class | elseSchema = [ElseSchema::class.java](#elseschema) | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedString](#validateagainstcorrectbranchthenvselse1boxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedVoid](#validateagainstcorrectbranchthenvselse1boxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedNumber](#validateagainstcorrectbranchthenvselse1boxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean](#validateagainstcorrectbranchthenvselse1boxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedMap](#validateagainstcorrectbranchthenvselse1boxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1BoxedList](#validateagainstcorrectbranchthenvselse1boxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ValidateAgainstCorrectBranchThenVsElse1Boxed](#validateagainstcorrectbranchthenvselse1boxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ThenBoxed +sealed interface ThenBoxed
+permits
+[ThenBoxedVoid](#thenboxedvoid), +[ThenBoxedBoolean](#thenboxedboolean), +[ThenBoxedNumber](#thenboxednumber), +[ThenBoxedString](#thenboxedstring), +[ThenBoxedList](#thenboxedlist), +[ThenBoxedMap](#thenboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ThenBoxedVoid +data class ThenBoxedVoid
+implements [ThenBoxed](#thenboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedBoolean +data class ThenBoxedBoolean
+implements [ThenBoxed](#thenboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedNumber +data class ThenBoxedNumber
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedString +data class ThenBoxedString
+implements [ThenBoxed](#thenboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedList +data class ThenBoxedList
+implements [ThenBoxed](#thenboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ThenBoxedMap +data class ThenBoxedMap
+implements [ThenBoxed](#thenboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ThenBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## Then +class Then
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | minimum = -10 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ThenBoxedString](#thenboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ThenBoxedVoid](#thenboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ThenBoxedNumber](#thenboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ThenBoxedBoolean](#thenboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ThenBoxedMap](#thenboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ThenBoxedList](#thenboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ThenBoxed](#thenboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## IfSchemaBoxed +sealed interface IfSchemaBoxed
+permits
+[IfSchemaBoxedVoid](#ifschemaboxedvoid), +[IfSchemaBoxedBoolean](#ifschemaboxedboolean), +[IfSchemaBoxedNumber](#ifschemaboxednumber), +[IfSchemaBoxedString](#ifschemaboxedstring), +[IfSchemaBoxedList](#ifschemaboxedlist), +[IfSchemaBoxedMap](#ifschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## IfSchemaBoxedVoid +data class IfSchemaBoxedVoid
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedBoolean +data class IfSchemaBoxedBoolean
+implements [IfSchemaBoxed](#ifschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedNumber +data class IfSchemaBoxedNumber
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedString +data class IfSchemaBoxedString
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedList +data class IfSchemaBoxedList
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchemaBoxedMap +data class IfSchemaBoxedMap
+implements [IfSchemaBoxed](#ifschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| IfSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## IfSchema +class IfSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| Number | exclusiveMaximum = 0 | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedString](#ifschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [IfSchemaBoxedVoid](#ifschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [IfSchemaBoxedNumber](#ifschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [IfSchemaBoxedBoolean](#ifschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [IfSchemaBoxedMap](#ifschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [IfSchemaBoxedList](#ifschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [IfSchemaBoxed](#ifschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +## ElseSchemaBoxed +sealed interface ElseSchemaBoxed
+permits
+[ElseSchemaBoxedVoid](#elseschemaboxedvoid), +[ElseSchemaBoxedBoolean](#elseschemaboxedboolean), +[ElseSchemaBoxedNumber](#elseschemaboxednumber), +[ElseSchemaBoxedString](#elseschemaboxedstring), +[ElseSchemaBoxedList](#elseschemaboxedlist), +[ElseSchemaBoxedMap](#elseschemaboxedmap) + +sealed interface that stores validated payloads using boxed classes + +## ElseSchemaBoxedVoid +data class ElseSchemaBoxedVoid
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated null payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedVoid(Nothing? data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedBoolean +data class ElseSchemaBoxedBoolean
+implements [ElseSchemaBoxed](#elseschemaboxed) + +record that stores validated boolean payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedBoolean(boolean data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedNumber +data class ElseSchemaBoxedNumber
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Number payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedNumber(Number data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedString +data class ElseSchemaBoxedString
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated String payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedString(String data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedList +data class ElseSchemaBoxedList
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated List payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedList(FrozenList data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenList | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchemaBoxedMap +data class ElseSchemaBoxedMap
+implements [ElseSchemaBoxed](#elseschemaboxed) + +data class that stores validated Map payloads, sealed permits implementation + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| ElseSchemaBoxedMap(FrozenMap data)
Creates an instance, private visibility | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| FrozenMap | data()
validated payload | +| Any? | getData()
validated payload | + +## ElseSchema +class ElseSchema
+extends JsonSchema + +A schema class that validates payloads + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +| BigDecimal | multipleOf = BigDecimal("2") | + +### Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | validate(arg: String, configuration: SchemaConfiguration) | +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedString](#elseschemaboxedstring) | validateAndBox(String, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedVoid](#elseschemaboxedvoid) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedNumber](#elseschemaboxednumber) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedBoolean](#elseschemaboxedboolean) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedMap](#elseschemaboxedmap) | validateAndBox(Map<?, ?>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxedList](#elseschemaboxedlist) | validateAndBox(List<*>, configuration: SchemaConfiguration) | +| [ElseSchemaBoxed](#elseschemaboxed) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | + +[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/docs/servers/RootServer0.md b/samples/client/3_1_0_unit_test/kotlin/docs/servers/RootServer0.md new file mode 100644 index 00000000000..08ddb1be947 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/docs/servers/RootServer0.md @@ -0,0 +1,17 @@ +org.openapijsonschematools.client.servers.RootServer0 +# Server RootServer0 +public class RootServer0 + +A class that stores a server url + +### Constructor Summary +| Constructor and Description | +| --------------------------- | +| RootServer0()
Creates a server | + +### Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "https://someserver.com/v1" | + +[[Back to top]](#top) [[Back to Servers]](../../README.md#Servers) [[Back to README]](../../README.md) diff --git a/samples/client/3_1_0_unit_test/kotlin/settings.gradle.kts b/samples/client/3_1_0_unit_test/kotlin/settings.gradle.kts new file mode 100644 index 00000000000..65c368589f6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "unit-test-api" + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt new file mode 100644 index 00000000000..2d583252938 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/RootServerInfo.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client + +import org.openapijsonschematools.client.servers.RootServer0 +import org.openapijsonschematools.client.servers.Server +import org.openapijsonschematools.client.servers.ServerProvider + +class RootServerInfo { + class RootServerInfo1( + private val server0: RootServer0 = RootServer0() + ) : ServerProvider { + + override fun getServer(serverIndex: ServerIndex): Server { + return server0 + } + } + + enum class ServerIndex { + SERVER_0 + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt new file mode 100644 index 00000000000..561f561d6f1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitems.kt @@ -0,0 +1,408 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ASchemaGivenForPrefixitems { + // nest classes so all schemas and input/output classes can be public + + + class ASchemaGivenForPrefixitemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitemsList { + return ASchemaGivenForPrefixitems1.getInstance().validate(arg, configuration) + } + } + } + + class ASchemaGivenForPrefixitemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ASchemaGivenForPrefixitemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ASchemaGivenForPrefixitemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface ASchemaGivenForPrefixitems1Boxed { + fun getData(): Any? + } + + data class ASchemaGivenForPrefixitems1BoxedVoid(val data: Nothing?) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedBoolean(val data: Boolean): ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedNumber(val data: Number) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedString(val data: String) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedList(val data: ASchemaGivenForPrefixitemsList) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ASchemaGivenForPrefixitems1BoxedMap(val data: FrozenMap) : ASchemaGivenForPrefixitems1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ASchemaGivenForPrefixitems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .prefixItems(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, ASchemaGivenForPrefixitems1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ASchemaGivenForPrefixitems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ASchemaGivenForPrefixitems1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ASchemaGivenForPrefixitemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ASchemaGivenForPrefixitemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedVoid { + return ASchemaGivenForPrefixitems1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedBoolean { + return ASchemaGivenForPrefixitems1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedNumber { + return ASchemaGivenForPrefixitems1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedString { + return ASchemaGivenForPrefixitems1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedList { + return ASchemaGivenForPrefixitems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1BoxedMap { + return ASchemaGivenForPrefixitems1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ASchemaGivenForPrefixitems1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt new file mode 100644 index 00000000000..185c54ed123 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefault.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalItemsAreAllowedByDefault { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalItemsAreAllowedByDefaultList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefaultList { + return AdditionalItemsAreAllowedByDefault1.getInstance().validate(arg, configuration) + } + } + } + + class AdditionalItemsAreAllowedByDefaultListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: String): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Int): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Float): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Long): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Double): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun add(item: Map): AdditionalItemsAreAllowedByDefaultListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface AdditionalItemsAreAllowedByDefault1Boxed { + fun getData(): Any? + } + + data class AdditionalItemsAreAllowedByDefault1BoxedVoid(val data: Nothing?) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedBoolean(val data: Boolean): AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedNumber(val data: Number) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedString(val data: String) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedList(val data: AdditionalItemsAreAllowedByDefaultList) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalItemsAreAllowedByDefault1BoxedMap(val data: FrozenMap) : AdditionalItemsAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalItemsAreAllowedByDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .prefixItems(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, AdditionalItemsAreAllowedByDefault1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalItemsAreAllowedByDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalItemsAreAllowedByDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalItemsAreAllowedByDefaultList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return AdditionalItemsAreAllowedByDefaultList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefaultList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedVoid { + return AdditionalItemsAreAllowedByDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedBoolean { + return AdditionalItemsAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedNumber { + return AdditionalItemsAreAllowedByDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedString { + return AdditionalItemsAreAllowedByDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedList { + return AdditionalItemsAreAllowedByDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1BoxedMap { + return AdditionalItemsAreAllowedByDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalItemsAreAllowedByDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt new file mode 100644 index 00000000000..2966b3216d6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.kt @@ -0,0 +1,518 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesAreAllowedByDefault { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesAreAllowedByDefaultMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesAreAllowedByDefaultMap { + return AdditionalpropertiesAreAllowedByDefault1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AdditionalpropertiesAreAllowedByDefaultMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesAreAllowedByDefaultMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesAreAllowedByDefault1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedVoid(val data: Nothing?) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(val data: Boolean): AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedNumber(val data: Number) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedString(val data: String) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedList(val data: FrozenList) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesAreAllowedByDefault1BoxedMap(val data: AdditionalpropertiesAreAllowedByDefaultMap) : AdditionalpropertiesAreAllowedByDefault1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesAreAllowedByDefault1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesAreAllowedByDefault1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesAreAllowedByDefault1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesAreAllowedByDefault1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesAreAllowedByDefaultMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesAreAllowedByDefaultMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefaultMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedVoid { + return AdditionalpropertiesAreAllowedByDefault1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedBoolean { + return AdditionalpropertiesAreAllowedByDefault1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedNumber { + return AdditionalpropertiesAreAllowedByDefault1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedString { + return AdditionalpropertiesAreAllowedByDefault1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedList { + return AdditionalpropertiesAreAllowedByDefault1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1BoxedMap { + return AdditionalpropertiesAreAllowedByDefault1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesAreAllowedByDefault1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt new file mode 100644 index 00000000000..ee604cec42a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesCanExistByItself { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class AdditionalpropertiesCanExistByItselfMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesCanExistByItselfMap { + return AdditionalpropertiesCanExistByItself1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesCanExistByItselfMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesCanExistByItselfMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesCanExistByItself1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesCanExistByItself1BoxedMap(val data: AdditionalpropertiesCanExistByItselfMap) : AdditionalpropertiesCanExistByItself1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesCanExistByItself1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesCanExistByItself1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesCanExistByItself1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesCanExistByItselfMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesCanExistByItselfMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItselfMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1BoxedMap { + return AdditionalpropertiesCanExistByItself1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesCanExistByItself1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt new file mode 100644 index 00000000000..2a31ca2a279 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicators.kt @@ -0,0 +1,787 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesDoesNotLookInApplicators { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0MapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0MapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0MapBuilder { + return this + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class AdditionalpropertiesDoesNotLookInApplicatorsMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesDoesNotLookInApplicatorsMap { + return AdditionalpropertiesDoesNotLookInApplicators1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesDoesNotLookInApplicatorsMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesDoesNotLookInApplicators1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid(val data: Nothing?) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean(val data: Boolean): AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber(val data: Number) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedString(val data: String) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedList(val data: FrozenList) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AdditionalpropertiesDoesNotLookInApplicators1BoxedMap(val data: AdditionalpropertiesDoesNotLookInApplicatorsMap) : AdditionalpropertiesDoesNotLookInApplicators1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesDoesNotLookInApplicators1 private constructor(): JsonSchema( + JsonSchemaInfo() + .additionalProperties(AdditionalProperties::class.java) + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AdditionalpropertiesDoesNotLookInApplicators1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesDoesNotLookInApplicators1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesDoesNotLookInApplicators1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesDoesNotLookInApplicatorsMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance is Boolean)) { + throw RuntimeException("Invalid instantiated value") + } + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesDoesNotLookInApplicatorsMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicatorsMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedString { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedList { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1BoxedMap { + return AdditionalpropertiesDoesNotLookInApplicators1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesDoesNotLookInApplicators1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..1926d960cfc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,178 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class AdditionalpropertiesWithNullValuedInstancePropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesWithNullValuedInstancePropertiesMap { + return AdditionalpropertiesWithNullValuedInstanceProperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun getAdditionalProperty(name: String): Nothing? { + return getOrThrow(name) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder: GenericBuilder>, SetterForAdditionalProperties { + private val knownKeys: Set = setOf() + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesWithNullValuedInstancePropertiesMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap(val data: AdditionalpropertiesWithNullValuedInstancePropertiesMap) : AdditionalpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesWithNullValuedInstancePropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + if (!(propertyInstance == null || propertyInstance is Nothing?)) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesWithNullValuedInstancePropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithNullValuedInstancePropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap { + return AdditionalpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesWithNullValuedInstanceProperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt new file mode 100644 index 00000000000..a64da97eb59 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchema.kt @@ -0,0 +1,351 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AdditionalpropertiesWithSchema { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AdditionalpropertiesWithSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AdditionalpropertiesWithSchemaMap { + return AdditionalpropertiesWithSchema1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Boolean { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + val value = getOrThrow(name) + if (!(value is Boolean)) { + throw RuntimeException("Invalid value stored for " + name) + } + return value + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class AdditionalpropertiesWithSchemaMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): AdditionalpropertiesWithSchemaMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): AdditionalpropertiesWithSchemaMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AdditionalpropertiesWithSchemaMapBuilder { + return this + } + } + + + sealed interface AdditionalpropertiesWithSchema1Boxed { + fun getData(): Any? + } + + data class AdditionalpropertiesWithSchema1BoxedMap(val data: AdditionalpropertiesWithSchemaMap) : AdditionalpropertiesWithSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AdditionalpropertiesWithSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AdditionalpropertiesWithSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalpropertiesWithSchema1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AdditionalpropertiesWithSchemaMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AdditionalpropertiesWithSchemaMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AdditionalpropertiesWithSchema1BoxedMap { + return AdditionalpropertiesWithSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AdditionalpropertiesWithSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt new file mode 100644 index 00000000000..4d04ec0291e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Allof.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Allof { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Allof1Boxed { + fun getData(): Any? + } + + data class Allof1BoxedVoid(val data: Nothing?) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedBoolean(val data: Boolean): Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedNumber(val data: Number) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedString(val data: String) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedList(val data: FrozenList) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Allof1BoxedMap(val data: FrozenMap) : Allof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Allof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Allof1BoxedList>, MapSchemaValidator, Allof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Allof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Allof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Allof1BoxedVoid { + return Allof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Allof1BoxedBoolean { + return Allof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Allof1BoxedNumber { + return Allof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Allof1BoxedString { + return Allof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Allof1BoxedList { + return Allof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Allof1BoxedMap { + return Allof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Allof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt new file mode 100644 index 00000000000..22448768881 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.kt @@ -0,0 +1,1142 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofCombinedWithAnyofOneof { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema02Boxed { + fun getData(): Any? + } + + data class Schema02BoxedVoid(val data: Nothing?) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedBoolean(val data: Boolean): Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedNumber(val data: Number) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedString(val data: String) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedList(val data: FrozenList) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema02BoxedMap(val data: FrozenMap) : Schema02Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema02 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema02BoxedList>, MapSchemaValidator, Schema02BoxedMap> { + + companion object { + @Volatile + private var instance: Schema02? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema02().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema02BoxedVoid { + return Schema02BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema02BoxedBoolean { + return Schema02BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema02BoxedNumber { + return Schema02BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema02BoxedString { + return Schema02BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema02BoxedList { + return Schema02BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema02BoxedMap { + return Schema02BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema02Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema01Boxed { + fun getData(): Any? + } + + data class Schema01BoxedVoid(val data: Nothing?) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedBoolean(val data: Boolean): Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedNumber(val data: Number) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedString(val data: String) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedList(val data: FrozenList) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema01BoxedMap(val data: FrozenMap) : Schema01Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema01 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema01BoxedList>, MapSchemaValidator, Schema01BoxedMap> { + + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema01BoxedVoid { + return Schema01BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema01BoxedBoolean { + return Schema01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema01BoxedNumber { + return Schema01BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema01BoxedString { + return Schema01BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema01BoxedList { + return Schema01BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema01BoxedMap { + return Schema01BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema01Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofCombinedWithAnyofOneof1Boxed { + fun getData(): Any? + } + + data class AllofCombinedWithAnyofOneof1BoxedVoid(val data: Nothing?) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedBoolean(val data: Boolean): AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedNumber(val data: Number) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedString(val data: String) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedList(val data: FrozenList) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofCombinedWithAnyofOneof1BoxedMap(val data: FrozenMap) : AllofCombinedWithAnyofOneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofCombinedWithAnyofOneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema02::class.java + )) + .anyOf(listOf( + Schema01::class.java + )) + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofCombinedWithAnyofOneof1BoxedList>, MapSchemaValidator, AllofCombinedWithAnyofOneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofCombinedWithAnyofOneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofCombinedWithAnyofOneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedVoid { + return AllofCombinedWithAnyofOneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedBoolean { + return AllofCombinedWithAnyofOneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedNumber { + return AllofCombinedWithAnyofOneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedString { + return AllofCombinedWithAnyofOneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedList { + return AllofCombinedWithAnyofOneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1BoxedMap { + return AllofCombinedWithAnyofOneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofCombinedWithAnyofOneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt new file mode 100644 index 00000000000..1311748cc47 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.kt @@ -0,0 +1,861 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofSimpleTypes { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(30) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(20) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AllofSimpleTypes1Boxed { + fun getData(): Any? + } + + data class AllofSimpleTypes1BoxedVoid(val data: Nothing?) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedBoolean(val data: Boolean): AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedNumber(val data: Number) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedString(val data: String) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedList(val data: FrozenList) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofSimpleTypes1BoxedMap(val data: FrozenMap) : AllofSimpleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofSimpleTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofSimpleTypes1BoxedList>, MapSchemaValidator, AllofSimpleTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofSimpleTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofSimpleTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedVoid { + return AllofSimpleTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedBoolean { + return AllofSimpleTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedNumber { + return AllofSimpleTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedString { + return AllofSimpleTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedList { + return AllofSimpleTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofSimpleTypes1BoxedMap { + return AllofSimpleTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofSimpleTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt new file mode 100644 index 00000000000..434a6b3cac3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.kt @@ -0,0 +1,1151 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Baz : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Baz? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Baz().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Nothing? { + val value: Any? = get("baz") + if (!(value == null || value is Nothing?)) { + throw RuntimeException("Invalid value stored for baz") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForBaz { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "baz" to Baz::class.java + )) + .required(setOf( + "baz" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class AllofWithBaseSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): AllofWithBaseSchemaMap { + return AllofWithBaseSchema1.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class AllofWithBaseSchemaMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return this + } + } + + class AllofWithBaseSchemaMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): AllofWithBaseSchemaMap0Builder { + return AllofWithBaseSchemaMap0Builder(instance) + } + } + + + sealed interface AllofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AllofWithBaseSchema1BoxedVoid(val data: Nothing?) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedBoolean(val data: Boolean): AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedNumber(val data: Number) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedString(val data: String) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedList(val data: FrozenList) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithBaseSchema1BoxedMap(val data: AllofWithBaseSchemaMap) : AllofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithBaseSchema1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): AllofWithBaseSchemaMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return AllofWithBaseSchemaMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedVoid { + return AllofWithBaseSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedBoolean { + return AllofWithBaseSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedNumber { + return AllofWithBaseSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedString { + return AllofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedList { + return AllofWithBaseSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithBaseSchema1BoxedMap { + return AllofWithBaseSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithBaseSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt new file mode 100644 index 00000000000..d52dc7697e6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.kt @@ -0,0 +1,324 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface AllofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedNumber(val data: Number) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedString(val data: String) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedList(val data: FrozenList) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AllofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedVoid { + return AllofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedBoolean { + return AllofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedNumber { + return AllofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedString { + return AllofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedList { + return AllofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1BoxedMap { + return AllofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt new file mode 100644 index 00000000000..05bc227949a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheFirstEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheFirstEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheFirstEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedNumber(val data: Number) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedString(val data: String) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheFirstEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheFirstEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheFirstEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheFirstEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheFirstEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheFirstEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheFirstEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedVoid { + return AllofWithTheFirstEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedBoolean { + return AllofWithTheFirstEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedNumber { + return AllofWithTheFirstEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedString { + return AllofWithTheFirstEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedList { + return AllofWithTheFirstEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1BoxedMap { + return AllofWithTheFirstEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheFirstEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt new file mode 100644 index 00000000000..fa3b00d842e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTheLastEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTheLastEmptySchema1Boxed { + fun getData(): Any? + } + + data class AllofWithTheLastEmptySchema1BoxedVoid(val data: Nothing?) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedBoolean(val data: Boolean): AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedNumber(val data: Number) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedString(val data: String) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedList(val data: FrozenList) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTheLastEmptySchema1BoxedMap(val data: FrozenMap) : AllofWithTheLastEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTheLastEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTheLastEmptySchema1BoxedList>, MapSchemaValidator, AllofWithTheLastEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTheLastEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTheLastEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedVoid { + return AllofWithTheLastEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedBoolean { + return AllofWithTheLastEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedNumber { + return AllofWithTheLastEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedString { + return AllofWithTheLastEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedList { + return AllofWithTheLastEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1BoxedMap { + return AllofWithTheLastEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTheLastEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt new file mode 100644 index 00000000000..6ac254eada1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemas.kt @@ -0,0 +1,338 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AllofWithTwoEmptySchemas { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AllofWithTwoEmptySchemas1Boxed { + fun getData(): Any? + } + + data class AllofWithTwoEmptySchemas1BoxedVoid(val data: Nothing?) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedBoolean(val data: Boolean): AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedNumber(val data: Number) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedString(val data: String) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedList(val data: FrozenList) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AllofWithTwoEmptySchemas1BoxedMap(val data: FrozenMap) : AllofWithTwoEmptySchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AllofWithTwoEmptySchemas1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AllofWithTwoEmptySchemas1BoxedList>, MapSchemaValidator, AllofWithTwoEmptySchemas1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AllofWithTwoEmptySchemas1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AllofWithTwoEmptySchemas1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedVoid { + return AllofWithTwoEmptySchemas1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedBoolean { + return AllofWithTwoEmptySchemas1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedNumber { + return AllofWithTwoEmptySchemas1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedString { + return AllofWithTwoEmptySchemas1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedList { + return AllofWithTwoEmptySchemas1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1BoxedMap { + return AllofWithTwoEmptySchemas1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AllofWithTwoEmptySchemas1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt new file mode 100644 index 00000000000..c71b31c6ce0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Anyof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Anyof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Anyof1Boxed { + fun getData(): Any? + } + + data class Anyof1BoxedVoid(val data: Nothing?) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedBoolean(val data: Boolean): Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedNumber(val data: Number) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedString(val data: String) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedList(val data: FrozenList) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Anyof1BoxedMap(val data: FrozenMap) : Anyof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Anyof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Anyof1BoxedList>, MapSchemaValidator, Anyof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Anyof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Anyof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Anyof1BoxedVoid { + return Anyof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Anyof1BoxedBoolean { + return Anyof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Anyof1BoxedNumber { + return Anyof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Anyof1BoxedString { + return Anyof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Anyof1BoxedList { + return Anyof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Anyof1BoxedMap { + return Anyof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Anyof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt new file mode 100644 index 00000000000..8abf0c0c3cb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofComplexTypes1Boxed { + fun getData(): Any? + } + + data class AnyofComplexTypes1BoxedVoid(val data: Nothing?) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedBoolean(val data: Boolean): AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedNumber(val data: Number) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedString(val data: String) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedList(val data: FrozenList) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofComplexTypes1BoxedMap(val data: FrozenMap) : AnyofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofComplexTypes1BoxedList>, MapSchemaValidator, AnyofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedVoid { + return AnyofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedBoolean { + return AnyofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedNumber { + return AnyofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedString { + return AnyofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedList { + return AnyofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofComplexTypes1BoxedMap { + return AnyofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt new file mode 100644 index 00000000000..c6c6cd7ba74 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface AnyofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithBaseSchema1BoxedString(val data: String) : AnyofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class AnyofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithBaseSchema1BoxedString { + return AnyofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt new file mode 100644 index 00000000000..6bd29945cdc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class AnyofWithOneEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface AnyofWithOneEmptySchema1Boxed { + fun getData(): Any? + } + + data class AnyofWithOneEmptySchema1BoxedVoid(val data: Nothing?) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedBoolean(val data: Boolean): AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedNumber(val data: Number) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedString(val data: String) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedList(val data: FrozenList) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class AnyofWithOneEmptySchema1BoxedMap(val data: FrozenMap) : AnyofWithOneEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class AnyofWithOneEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AnyofWithOneEmptySchema1BoxedList>, MapSchemaValidator, AnyofWithOneEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: AnyofWithOneEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyofWithOneEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedVoid { + return AnyofWithOneEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedBoolean { + return AnyofWithOneEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedNumber { + return AnyofWithOneEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedString { + return AnyofWithOneEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedList { + return AnyofWithOneEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1BoxedMap { + return AnyofWithOneEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyofWithOneEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt new file mode 100644 index 00000000000..27a7304f30f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArrays.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.ListJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList + +class ArrayTypeMatchesArrays: ListJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class ArrayTypeMatchesArrays1 : ListJsonSchema.ListJsonSchema1() { + companion object { + @Volatile + private var instance: ArrayTypeMatchesArrays1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ArrayTypeMatchesArrays1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt new file mode 100644 index 00000000000..f557463b4d8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleans.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.BooleanJsonSchema + +class BooleanTypeMatchesBooleans: BooleanJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class BooleanTypeMatchesBooleans1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: BooleanTypeMatchesBooleans1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanTypeMatchesBooleans1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt new file mode 100644 index 00000000000..e02942f3d65 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByInt.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByInt { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByInt1Boxed { + fun getData(): Any? + } + + data class ByInt1BoxedVoid(val data: Nothing?) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedBoolean(val data: Boolean): ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedNumber(val data: Number) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedString(val data: String) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedList(val data: FrozenList) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByInt1BoxedMap(val data: FrozenMap) : ByInt1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByInt1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByInt1BoxedList>, MapSchemaValidator, ByInt1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByInt1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByInt1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByInt1BoxedVoid { + return ByInt1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByInt1BoxedBoolean { + return ByInt1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByInt1BoxedNumber { + return ByInt1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByInt1BoxedString { + return ByInt1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByInt1BoxedList { + return ByInt1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByInt1BoxedMap { + return ByInt1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByInt1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt new file mode 100644 index 00000000000..92ab5a5ee41 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ByNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ByNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ByNumber1Boxed { + fun getData(): Any? + } + + data class ByNumber1BoxedVoid(val data: Nothing?) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedBoolean(val data: Boolean): ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedNumber(val data: Number) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedString(val data: String) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedList(val data: FrozenList) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ByNumber1BoxedMap(val data: FrozenMap) : ByNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ByNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("1.5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ByNumber1BoxedList>, MapSchemaValidator, ByNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ByNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ByNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ByNumber1BoxedVoid { + return ByNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ByNumber1BoxedBoolean { + return ByNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ByNumber1BoxedNumber { + return ByNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ByNumber1BoxedString { + return ByNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ByNumber1BoxedList { + return ByNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ByNumber1BoxedMap { + return ByNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ByNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt new file mode 100644 index 00000000000..3f9c9b3ffe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumber.kt @@ -0,0 +1,309 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class BySmallNumber { + // nest classes so all schemas and input/output classes can be public + + + sealed interface BySmallNumber1Boxed { + fun getData(): Any? + } + + data class BySmallNumber1BoxedVoid(val data: Nothing?) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedBoolean(val data: Boolean): BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedNumber(val data: Number) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedString(val data: String) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedList(val data: FrozenList) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + data class BySmallNumber1BoxedMap(val data: FrozenMap) : BySmallNumber1Boxed { + override fun getData(): Any? { + return data + } + } + + + class BySmallNumber1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("0.00010")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BySmallNumber1BoxedList>, MapSchemaValidator, BySmallNumber1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: BySmallNumber1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BySmallNumber1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): BySmallNumber1BoxedVoid { + return BySmallNumber1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BySmallNumber1BoxedBoolean { + return BySmallNumber1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): BySmallNumber1BoxedNumber { + return BySmallNumber1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BySmallNumber1BoxedString { + return BySmallNumber1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BySmallNumber1BoxedList { + return BySmallNumber1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BySmallNumber1BoxedMap { + return BySmallNumber1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BySmallNumber1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt new file mode 100644 index 00000000000..6d794527178 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStrings.kt @@ -0,0 +1,318 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ConstNulCharactersInStrings { + // nest classes so all schemas and input/output classes can be public + + enum class StringConstNulCharactersInStringsConst(private val value: String): StringValueMethod { + HELLO_NULL_THERE("hello\u0000there"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ConstNulCharactersInStrings1Boxed { + fun getData(): Any? + } + + data class ConstNulCharactersInStrings1BoxedVoid(val data: Nothing?) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedBoolean(val data: Boolean): ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedNumber(val data: Number) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedString(val data: String) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedList(val data: FrozenList) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ConstNulCharactersInStrings1BoxedMap(val data: FrozenMap) : ConstNulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ConstNulCharactersInStrings1 private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("hello\u0000there") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ConstNulCharactersInStrings1BoxedList>, MapSchemaValidator, ConstNulCharactersInStrings1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ConstNulCharactersInStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ConstNulCharactersInStrings1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedVoid { + return ConstNulCharactersInStrings1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedBoolean { + return ConstNulCharactersInStrings1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedNumber { + return ConstNulCharactersInStrings1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedString { + return ConstNulCharactersInStrings1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedList { + return ConstNulCharactersInStrings1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1BoxedMap { + return ConstNulCharactersInStrings1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ConstNulCharactersInStrings1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt new file mode 100644 index 00000000000..059c14dac3a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidation.kt @@ -0,0 +1,583 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ContainsKeywordValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ContainsBoxed { + fun getData(): Any? + } + + data class ContainsBoxedVoid(val data: Nothing?) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedBoolean(val data: Boolean): ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedNumber(val data: Number) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedString(val data: String) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedList(val data: FrozenList) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedMap(val data: FrozenMap) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Contains private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(5) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsBoxedList>, MapSchemaValidator, ContainsBoxedMap> { + + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsBoxedVoid { + return ContainsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsBoxedBoolean { + return ContainsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsBoxedNumber { + return ContainsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsBoxedString { + return ContainsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsBoxedList { + return ContainsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsBoxedMap { + return ContainsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ContainsKeywordValidation1Boxed { + fun getData(): Any? + } + + data class ContainsKeywordValidation1BoxedVoid(val data: Nothing?) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedBoolean(val data: Boolean): ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedNumber(val data: Number) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedString(val data: String) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedList(val data: FrozenList) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsKeywordValidation1BoxedMap(val data: FrozenMap) : ContainsKeywordValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ContainsKeywordValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsKeywordValidation1BoxedList>, MapSchemaValidator, ContainsKeywordValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ContainsKeywordValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ContainsKeywordValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedVoid { + return ContainsKeywordValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedBoolean { + return ContainsKeywordValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedNumber { + return ContainsKeywordValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedString { + return ContainsKeywordValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedList { + return ContainsKeywordValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsKeywordValidation1BoxedMap { + return ContainsKeywordValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsKeywordValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt new file mode 100644 index 00000000000..9b0d868ae47 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElements.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ContainsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class Contains : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + } + + + sealed interface ContainsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class ContainsWithNullInstanceElements1BoxedVoid(val data: Nothing?) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedBoolean(val data: Boolean): ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedNumber(val data: Number) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedString(val data: String) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedList(val data: FrozenList) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsWithNullInstanceElements1BoxedMap(val data: FrozenMap) : ContainsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ContainsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsWithNullInstanceElements1BoxedList>, MapSchemaValidator, ContainsWithNullInstanceElements1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ContainsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ContainsWithNullInstanceElements1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedVoid { + return ContainsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedBoolean { + return ContainsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedNumber { + return ContainsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedString { + return ContainsWithNullInstanceElements1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedList { + return ContainsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1BoxedMap { + return ContainsWithNullInstanceElements1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsWithNullInstanceElements1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt new file mode 100644 index 00000000000..5064560701f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DateFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DateFormat1Boxed { + fun getData(): Any? + } + + data class DateFormat1BoxedVoid(val data: Nothing?) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedBoolean(val data: Boolean): DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedNumber(val data: Number) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedString(val data: String) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedList(val data: FrozenList) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateFormat1BoxedMap(val data: FrozenMap) : DateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DateFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("date") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateFormat1BoxedList>, MapSchemaValidator, DateFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DateFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DateFormat1BoxedVoid { + return DateFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DateFormat1BoxedBoolean { + return DateFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DateFormat1BoxedNumber { + return DateFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateFormat1BoxedString { + return DateFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DateFormat1BoxedList { + return DateFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DateFormat1BoxedMap { + return DateFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt new file mode 100644 index 00000000000..034656f3583 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DateTimeFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DateTimeFormat1Boxed { + fun getData(): Any? + } + + data class DateTimeFormat1BoxedVoid(val data: Nothing?) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedBoolean(val data: Boolean): DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedNumber(val data: Number) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedString(val data: String) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedList(val data: FrozenList) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DateTimeFormat1BoxedMap(val data: FrozenMap) : DateTimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DateTimeFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("date-time") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DateTimeFormat1BoxedList>, MapSchemaValidator, DateTimeFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DateTimeFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DateTimeFormat1BoxedVoid { + return DateTimeFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DateTimeFormat1BoxedBoolean { + return DateTimeFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DateTimeFormat1BoxedNumber { + return DateTimeFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeFormat1BoxedString { + return DateTimeFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedList { + return DateTimeFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DateTimeFormat1BoxedMap { + return DateTimeFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt new file mode 100644 index 00000000000..34e86b1b5d4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharacters.kt @@ -0,0 +1,975 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DependentSchemasDependenciesWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + sealed interface FootbarBoxed { + fun getData(): Any? + } + + data class FootbarBoxedVoid(val data: Nothing?) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedBoolean(val data: Boolean): FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedNumber(val data: Number) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedString(val data: String) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedList(val data: FrozenList) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FootbarBoxedMap(val data: FrozenMap) : FootbarBoxed { + override fun getData(): Any? { + return data + } + } + + + class Footbar private constructor(): JsonSchema( + JsonSchemaInfo() + .minProperties(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FootbarBoxedList>, MapSchemaValidator, FootbarBoxedMap> { + + companion object { + @Volatile + private var instance: Footbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Footbar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FootbarBoxedVoid { + return FootbarBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FootbarBoxedBoolean { + return FootbarBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FootbarBoxedNumber { + return FootbarBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FootbarBoxedString { + return FootbarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FootbarBoxedList { + return FootbarBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FootbarBoxedMap { + return FootbarBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FootbarBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class FoobarMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo\"bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): FoobarMap { + return Foobar.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\"bar"] = null + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Boolean): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: String): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: List): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Map): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + class FoobarMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo\"bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): FoobarMap0Builder { + return this + } + } + + class FoobarMapBuilder: SetterForFoobar1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar1(instance: MutableMap): FoobarMap0Builder { + return FoobarMap0Builder(instance) + } + } + + + sealed interface FoobarBoxed { + fun getData(): Any? + } + + data class FoobarBoxedVoid(val data: Nothing?) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedBoolean(val data: Boolean): FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedNumber(val data: Number) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedString(val data: String) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedList(val data: FrozenList) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoobarBoxedMap(val data: FoobarMap) : FoobarBoxed { + override fun getData(): Any? { + return data + } + } + + + class Foobar private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "foo\"bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FoobarBoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Foobar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FoobarMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return FoobarMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FoobarMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FoobarBoxedVoid { + return FoobarBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FoobarBoxedBoolean { + return FoobarBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FoobarBoxedNumber { + return FoobarBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FoobarBoxedString { + return FoobarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FoobarBoxedList { + return FoobarBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FoobarBoxedMap { + return FoobarBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FoobarBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface DependentSchemasDependenciesWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid(val data: Nothing?) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean(val data: Boolean): DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber(val data: Number) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedString(val data: String) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedList(val data: FrozenList) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependenciesWithEscapedCharacters1BoxedMap(val data: FrozenMap) : DependentSchemasDependenciesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DependentSchemasDependenciesWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentSchemas(mapOf( + "foo\tbar" to Footbar::class.java, + "foo'bar" to Foobar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasDependenciesWithEscapedCharacters1BoxedList>, MapSchemaValidator, DependentSchemasDependenciesWithEscapedCharacters1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DependentSchemasDependenciesWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DependentSchemasDependenciesWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedString { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedList { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1BoxedMap { + return DependentSchemasDependenciesWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DependentSchemasDependenciesWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt new file mode 100644 index 00000000000..f06e3be553b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRoot.kt @@ -0,0 +1,652 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DependentSchemasDependentSubschemaIncompatibleWithRoot { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class FooMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): FooMap { + return Foo1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class FooMapBuilder1: GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "bar" + ) + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): FooMapBuilder1 { + return this + } + } + + + sealed interface Foo1Boxed { + fun getData(): Any? + } + + data class Foo1BoxedMap(val data: FooMap) : Foo1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Foo1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + ), MapSchemaValidator { + + companion object { + @Volatile + private var instance: Foo1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FooMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return FooMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FooMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Foo1BoxedMap { + return Foo1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Foo1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class DependentSchemasDependentSubschemaIncompatibleWithRootMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): DependentSchemasDependentSubschemaIncompatibleWithRootMap { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): DependentSchemasDependentSubschemaIncompatibleWithRootMapBuilder { + return this + } + } + + + sealed interface DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + fun getData(): Any? + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid(val data: Nothing?) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean(val data: Boolean): DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber(val data: Number) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString(val data: String) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList(val data: FrozenList) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap(val data: DependentSchemasDependentSubschemaIncompatibleWithRootMap) : DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DependentSchemasDependentSubschemaIncompatibleWithRoot1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .dependentSchemas(mapOf( + "foo" to Foo1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DependentSchemasDependentSubschemaIncompatibleWithRoot1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DependentSchemasDependentSubschemaIncompatibleWithRoot1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): DependentSchemasDependentSubschemaIncompatibleWithRootMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return DependentSchemasDependentSubschemaIncompatibleWithRootMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRootMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap { + return DependentSchemasDependentSubschemaIncompatibleWithRoot1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DependentSchemasDependentSubschemaIncompatibleWithRoot1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt new file mode 100644 index 00000000000..182091869f6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependency.kt @@ -0,0 +1,747 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DependentSchemasSingleDependency { + // nest classes so all schemas and input/output classes can be public + + + class Foo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar1 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar1().also { instance = it } + } + } + } + + + class BarMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): BarMap { + return Bar.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Number { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): Number { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar1 { + fun getInstance(): MutableMap + fun getBuilderAfterBar1(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar1(instance) + } + } + + class BarMapBuilder1: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar1 { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): BarMapBuilder1 { + return this + } + override fun getBuilderAfterBar1(instance: MutableMap): BarMapBuilder1 { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): BarMapBuilder1 { + return this + } + } + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedVoid(val data: Nothing?) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedBoolean(val data: Boolean): BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedNumber(val data: Number) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedList(val data: FrozenList) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + data class BarBoxedMap(val data: BarMap) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, BarBoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): BarMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return BarMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): BarMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): BarBoxedVoid { + return BarBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BarBoxedBoolean { + return BarBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): BarBoxedNumber { + return BarBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BarBoxedList { + return BarBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BarBoxedMap { + return BarBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface DependentSchemasSingleDependency1Boxed { + fun getData(): Any? + } + + data class DependentSchemasSingleDependency1BoxedVoid(val data: Nothing?) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedBoolean(val data: Boolean): DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedNumber(val data: Number) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedString(val data: String) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedList(val data: FrozenList) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DependentSchemasSingleDependency1BoxedMap(val data: FrozenMap) : DependentSchemasSingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DependentSchemasSingleDependency1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentSchemas(mapOf( + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DependentSchemasSingleDependency1BoxedList>, MapSchemaValidator, DependentSchemasSingleDependency1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DependentSchemasSingleDependency1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DependentSchemasSingleDependency1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedVoid { + return DependentSchemasSingleDependency1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedBoolean { + return DependentSchemasSingleDependency1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedNumber { + return DependentSchemasSingleDependency1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedString { + return DependentSchemasSingleDependency1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedList { + return DependentSchemasSingleDependency1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1BoxedMap { + return DependentSchemasSingleDependency1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DependentSchemasSingleDependency1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt new file mode 100644 index 00000000000..d08dbc639e5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class DurationFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface DurationFormat1Boxed { + fun getData(): Any? + } + + data class DurationFormat1BoxedVoid(val data: Nothing?) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedBoolean(val data: Boolean): DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedNumber(val data: Number) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedString(val data: String) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedList(val data: FrozenList) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class DurationFormat1BoxedMap(val data: FrozenMap) : DurationFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class DurationFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("duration") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, DurationFormat1BoxedList>, MapSchemaValidator, DurationFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: DurationFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DurationFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): DurationFormat1BoxedVoid { + return DurationFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): DurationFormat1BoxedBoolean { + return DurationFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DurationFormat1BoxedNumber { + return DurationFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DurationFormat1BoxedString { + return DurationFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): DurationFormat1BoxedList { + return DurationFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): DurationFormat1BoxedMap { + return DurationFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DurationFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt new file mode 100644 index 00000000000..ed88a6dc0c5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EmailFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface EmailFormat1Boxed { + fun getData(): Any? + } + + data class EmailFormat1BoxedVoid(val data: Nothing?) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedBoolean(val data: Boolean): EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedNumber(val data: Number) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedString(val data: String) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedList(val data: FrozenList) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmailFormat1BoxedMap(val data: FrozenMap) : EmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EmailFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("email") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EmailFormat1BoxedList>, MapSchemaValidator, EmailFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EmailFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EmailFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): EmailFormat1BoxedVoid { + return EmailFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EmailFormat1BoxedBoolean { + return EmailFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EmailFormat1BoxedNumber { + return EmailFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EmailFormat1BoxedString { + return EmailFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): EmailFormat1BoxedList { + return EmailFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EmailFormat1BoxedMap { + return EmailFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EmailFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt new file mode 100644 index 00000000000..07953ad9809 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependents.kt @@ -0,0 +1,316 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EmptyDependents { + // nest classes so all schemas and input/output classes can be public + + + sealed interface EmptyDependents1Boxed { + fun getData(): Any? + } + + data class EmptyDependents1BoxedVoid(val data: Nothing?) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedBoolean(val data: Boolean): EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedNumber(val data: Number) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedString(val data: String) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedList(val data: FrozenList) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + data class EmptyDependents1BoxedMap(val data: FrozenMap) : EmptyDependents1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EmptyDependents1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentRequired(mapOf( + Pair( + "bar", + setOf( + ) + ) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, EmptyDependents1BoxedList>, MapSchemaValidator, EmptyDependents1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EmptyDependents1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EmptyDependents1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): EmptyDependents1BoxedVoid { + return EmptyDependents1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EmptyDependents1BoxedBoolean { + return EmptyDependents1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EmptyDependents1BoxedNumber { + return EmptyDependents1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EmptyDependents1BoxedString { + return EmptyDependents1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): EmptyDependents1BoxedList { + return EmptyDependents1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EmptyDependents1BoxedMap { + return EmptyDependents1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EmptyDependents1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt new file mode 100644 index 00000000000..5d94f419354 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalse.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith0DoesNotMatchFalse { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith0DoesNotMatchFalseEnums(private val value: Int): IntegerValueMethod { + POSITIVE_0(0); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith0DoesNotMatchFalseEnums(private val value: Long): LongValueMethod { + POSITIVE_0(0L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith0DoesNotMatchFalseEnums(private val value: Float): FloatValueMethod { + POSITIVE_0(0.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith0DoesNotMatchFalseEnums(private val value: Double): DoubleValueMethod { + POSITIVE_0(0.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith0DoesNotMatchFalse1Boxed { + fun getData(): Any? + } + + data class EnumWith0DoesNotMatchFalse1BoxedNumber(val data: Number) : EnumWith0DoesNotMatchFalse1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith0DoesNotMatchFalse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("0") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith0DoesNotMatchFalse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith0DoesNotMatchFalse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith0DoesNotMatchFalseEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1BoxedNumber { + return EnumWith0DoesNotMatchFalse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith0DoesNotMatchFalse1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt new file mode 100644 index 00000000000..7397d4f728e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrue.kt @@ -0,0 +1,173 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWith1DoesNotMatchTrue { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerEnumWith1DoesNotMatchTrueEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1); + + override fun value(): Int { + return this.value + } + } + + enum class LongEnumWith1DoesNotMatchTrueEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatEnumWith1DoesNotMatchTrueEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleEnumWith1DoesNotMatchTrueEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface EnumWith1DoesNotMatchTrue1Boxed { + fun getData(): Any? + } + + data class EnumWith1DoesNotMatchTrue1BoxedNumber(val data: Number) : EnumWith1DoesNotMatchTrue1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWith1DoesNotMatchTrue1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWith1DoesNotMatchTrue1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWith1DoesNotMatchTrue1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleEnumWith1DoesNotMatchTrueEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1BoxedNumber { + return EnumWith1DoesNotMatchTrue1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWith1DoesNotMatchTrue1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt new file mode 100644 index 00000000000..4624e048623 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharacters.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + enum class StringEnumWithEscapedCharactersEnums(private val value: String): StringValueMethod { + FOO_LINE_FEED_LF_BAR("foo\nbar"), + FOO_CARRIAGE_RETURN_CR_BAR("foo\rbar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface EnumWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class EnumWithEscapedCharacters1BoxedString(val data: String) : EnumWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo\nbar", + "foo\rbar" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringEnumWithEscapedCharactersEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1BoxedString { + return EnumWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithEscapedCharacters1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt new file mode 100644 index 00000000000..bfc0dd03800 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithFalseDoesNotMatch0 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithFalseDoesNotMatch0Enums(private val value: Boolean): BooleanValueMethod { + FALSE(false); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithFalseDoesNotMatch01Boxed { + fun getData(): Any? + } + + data class EnumWithFalseDoesNotMatch01BoxedBoolean(val data: Boolean): EnumWithFalseDoesNotMatch01Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithFalseDoesNotMatch01 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + false + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithFalseDoesNotMatch01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithFalseDoesNotMatch01().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithFalseDoesNotMatch0Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01BoxedBoolean { + return EnumWithFalseDoesNotMatch01BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithFalseDoesNotMatch01Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt new file mode 100644 index 00000000000..2df59f8e594 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1.kt @@ -0,0 +1,102 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.BooleanEnumValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumWithTrueDoesNotMatch1 { + // nest classes so all schemas and input/output classes can be public + + enum class BooleanEnumWithTrueDoesNotMatch1Enums(private val value: Boolean): BooleanValueMethod { + TRUE(true); + + override fun value(): Boolean { + return this.value + } + } + + + sealed interface EnumWithTrueDoesNotMatch11Boxed { + fun getData(): Any? + } + + data class EnumWithTrueDoesNotMatch11BoxedBoolean(val data: Boolean): EnumWithTrueDoesNotMatch11Boxed { + override fun getData(): Any? { + return data + } + } + + + + class EnumWithTrueDoesNotMatch11 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + .enumValues(setOf( + true + )) + ), BooleanSchemaValidator, BooleanEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumWithTrueDoesNotMatch11? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumWithTrueDoesNotMatch11().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: BooleanEnumWithTrueDoesNotMatch1Enums, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11BoxedBoolean { + return EnumWithTrueDoesNotMatch11BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumWithTrueDoesNotMatch11Boxed { + if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt new file mode 100644 index 00000000000..50712e368ae --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInProperties.kt @@ -0,0 +1,394 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class EnumsInProperties { + // nest classes so all schemas and input/output classes can be public + + enum class StringFooEnums(private val value: String): StringValueMethod { + FOO("foo"); + + override fun value(): String { + return this.value + } + } + + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedString(val data: String) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "foo" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringFooEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FooBoxedString { + return FooBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + enum class StringBarEnums(private val value: String): StringValueMethod { + BAR("bar"); + + override fun value(): String { + return this.value + } + } + + + sealed interface BarBoxed { + fun getData(): Any? + } + + data class BarBoxedString(val data: String) : BarBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Bar private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "bar" + )) + ), StringSchemaValidator, StringEnumValidator { + + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringBarEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): BarBoxedString { + return BarBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BarBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class EnumsInPropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): EnumsInPropertiesMap { + return EnumsInProperties1.getInstance().validate(arg, configuration) + } + } + + fun bar(): String { + val value: Any? = get("bar") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: StringBarEnums): T { + val instance = getInstance() + instance["bar"] = value.value() + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: StringFooEnums): T { + val instance = getInstance() + instance["foo"] = value.value() + return getBuilderAfterFoo(instance) + } + } + + class EnumsInPropertiesMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): EnumsInPropertiesMap0Builder { + return this + } + } + + class EnumsInPropertiesMapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): EnumsInPropertiesMap0Builder { + return EnumsInPropertiesMap0Builder(instance) + } + } + + + sealed interface EnumsInProperties1Boxed { + fun getData(): Any? + } + + data class EnumsInProperties1BoxedMap(val data: EnumsInPropertiesMap) : EnumsInProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class EnumsInProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: EnumsInProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: EnumsInProperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): EnumsInPropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return EnumsInPropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInPropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): EnumsInProperties1BoxedMap { + return EnumsInProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): EnumsInProperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt new file mode 100644 index 00000000000..ef73329fbe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ExclusivemaximumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ExclusivemaximumValidation1Boxed { + fun getData(): Any? + } + + data class ExclusivemaximumValidation1BoxedVoid(val data: Nothing?) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedBoolean(val data: Boolean): ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedNumber(val data: Number) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedString(val data: String) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedList(val data: FrozenList) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusivemaximumValidation1BoxedMap(val data: FrozenMap) : ExclusivemaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ExclusivemaximumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(3.0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ExclusivemaximumValidation1BoxedList>, MapSchemaValidator, ExclusivemaximumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ExclusivemaximumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ExclusivemaximumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedVoid { + return ExclusivemaximumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedBoolean { + return ExclusivemaximumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedNumber { + return ExclusivemaximumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedString { + return ExclusivemaximumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedList { + return ExclusivemaximumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ExclusivemaximumValidation1BoxedMap { + return ExclusivemaximumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ExclusivemaximumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt new file mode 100644 index 00000000000..18e56a3a845 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ExclusiveminimumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ExclusiveminimumValidation1Boxed { + fun getData(): Any? + } + + data class ExclusiveminimumValidation1BoxedVoid(val data: Nothing?) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedBoolean(val data: Boolean): ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedNumber(val data: Number) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedString(val data: String) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedList(val data: FrozenList) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ExclusiveminimumValidation1BoxedMap(val data: FrozenMap) : ExclusiveminimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ExclusiveminimumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMinimum(1.1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ExclusiveminimumValidation1BoxedList>, MapSchemaValidator, ExclusiveminimumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ExclusiveminimumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ExclusiveminimumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedVoid { + return ExclusiveminimumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedBoolean { + return ExclusiveminimumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedNumber { + return ExclusiveminimumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedString { + return ExclusiveminimumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedList { + return ExclusiveminimumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ExclusiveminimumValidation1BoxedMap { + return ExclusiveminimumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ExclusiveminimumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt new file mode 100644 index 00000000000..9d83a4c1936 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInf.kt @@ -0,0 +1,112 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class FloatDivisionInf { + // nest classes so all schemas and input/output classes can be public + + + sealed interface FloatDivisionInf1Boxed { + fun getData(): Any? + } + + data class FloatDivisionInf1BoxedNumber(val data: Number) : FloatDivisionInf1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class FloatDivisionInf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("int") + .multipleOf(BigDecimal("0.123456789")) + ), NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: FloatDivisionInf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatDivisionInf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatDivisionInf1BoxedNumber { + return FloatDivisionInf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatDivisionInf1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt new file mode 100644 index 00000000000..fc91855ede5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenProperty.kt @@ -0,0 +1,710 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ForbiddenProperty { + // nest classes so all schemas and input/output classes can be public + + + class Not : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + } + + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedVoid(val data: Nothing?) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedBoolean(val data: Boolean): FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedNumber(val data: Number) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedString(val data: String) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedList(val data: FrozenList) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + data class FooBoxedMap(val data: FrozenMap) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FooBoxedList>, MapSchemaValidator, FooBoxedMap> { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FooBoxedVoid { + return FooBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FooBoxedBoolean { + return FooBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FooBoxedNumber { + return FooBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FooBoxedString { + return FooBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FooBoxedList { + return FooBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FooBoxedMap { + return FooBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ForbiddenPropertyMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ForbiddenPropertyMap { + return ForbiddenProperty1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class ForbiddenPropertyMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ForbiddenPropertyMapBuilder { + return this + } + } + + + sealed interface ForbiddenProperty1Boxed { + fun getData(): Any? + } + + data class ForbiddenProperty1BoxedVoid(val data: Nothing?) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedBoolean(val data: Boolean): ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedNumber(val data: Number) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedString(val data: String) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedList(val data: FrozenList) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ForbiddenProperty1BoxedMap(val data: ForbiddenPropertyMap) : ForbiddenProperty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ForbiddenProperty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ForbiddenProperty1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ForbiddenProperty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ForbiddenProperty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ForbiddenPropertyMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ForbiddenPropertyMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenPropertyMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedVoid { + return ForbiddenProperty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedBoolean { + return ForbiddenProperty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedNumber { + return ForbiddenProperty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedString { + return ForbiddenProperty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedList { + return ForbiddenProperty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ForbiddenProperty1BoxedMap { + return ForbiddenProperty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ForbiddenProperty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt new file mode 100644 index 00000000000..63cefc4f9fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class HostnameFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface HostnameFormat1Boxed { + fun getData(): Any? + } + + data class HostnameFormat1BoxedVoid(val data: Nothing?) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedBoolean(val data: Boolean): HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedNumber(val data: Number) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedString(val data: String) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedList(val data: FrozenList) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class HostnameFormat1BoxedMap(val data: FrozenMap) : HostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class HostnameFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("hostname") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, HostnameFormat1BoxedList>, MapSchemaValidator, HostnameFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: HostnameFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: HostnameFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): HostnameFormat1BoxedVoid { + return HostnameFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): HostnameFormat1BoxedBoolean { + return HostnameFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): HostnameFormat1BoxedNumber { + return HostnameFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): HostnameFormat1BoxedString { + return HostnameFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): HostnameFormat1BoxedList { + return HostnameFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): HostnameFormat1BoxedMap { + return HostnameFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): HostnameFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt new file mode 100644 index 00000000000..d03befb9905 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IdnEmailFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IdnEmailFormat1Boxed { + fun getData(): Any? + } + + data class IdnEmailFormat1BoxedVoid(val data: Nothing?) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedBoolean(val data: Boolean): IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedNumber(val data: Number) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedString(val data: String) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedList(val data: FrozenList) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnEmailFormat1BoxedMap(val data: FrozenMap) : IdnEmailFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IdnEmailFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("idn-email") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IdnEmailFormat1BoxedList>, MapSchemaValidator, IdnEmailFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IdnEmailFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IdnEmailFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedVoid { + return IdnEmailFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedBoolean { + return IdnEmailFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedNumber { + return IdnEmailFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedString { + return IdnEmailFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedList { + return IdnEmailFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IdnEmailFormat1BoxedMap { + return IdnEmailFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IdnEmailFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt new file mode 100644 index 00000000000..2de5abdb4e3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IdnHostnameFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IdnHostnameFormat1Boxed { + fun getData(): Any? + } + + data class IdnHostnameFormat1BoxedVoid(val data: Nothing?) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedBoolean(val data: Boolean): IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedNumber(val data: Number) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedString(val data: String) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedList(val data: FrozenList) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IdnHostnameFormat1BoxedMap(val data: FrozenMap) : IdnHostnameFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IdnHostnameFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("idn-hostname") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IdnHostnameFormat1BoxedList>, MapSchemaValidator, IdnHostnameFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IdnHostnameFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IdnHostnameFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedVoid { + return IdnHostnameFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedBoolean { + return IdnHostnameFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedNumber { + return IdnHostnameFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedString { + return IdnHostnameFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedList { + return IdnHostnameFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IdnHostnameFormat1BoxedMap { + return IdnHostnameFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IdnHostnameFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt new file mode 100644 index 00000000000..081637155f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThen.kt @@ -0,0 +1,860 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IfAndElseWithoutThen { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfAndElseWithoutThen1Boxed { + fun getData(): Any? + } + + data class IfAndElseWithoutThen1BoxedVoid(val data: Nothing?) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedBoolean(val data: Boolean): IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedNumber(val data: Number) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedString(val data: String) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedList(val data: FrozenList) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndElseWithoutThen1BoxedMap(val data: FrozenMap) : IfAndElseWithoutThen1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IfAndElseWithoutThen1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfAndElseWithoutThen1BoxedList>, MapSchemaValidator, IfAndElseWithoutThen1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IfAndElseWithoutThen1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfAndElseWithoutThen1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedVoid { + return IfAndElseWithoutThen1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedBoolean { + return IfAndElseWithoutThen1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedNumber { + return IfAndElseWithoutThen1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedString { + return IfAndElseWithoutThen1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedList { + return IfAndElseWithoutThen1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfAndElseWithoutThen1BoxedMap { + return IfAndElseWithoutThen1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfAndElseWithoutThen1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt new file mode 100644 index 00000000000..89e68480e78 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElse.kt @@ -0,0 +1,859 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IfAndThenWithoutElse { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-10) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfAndThenWithoutElse1Boxed { + fun getData(): Any? + } + + data class IfAndThenWithoutElse1BoxedVoid(val data: Nothing?) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedBoolean(val data: Boolean): IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedNumber(val data: Number) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedString(val data: String) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedList(val data: FrozenList) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAndThenWithoutElse1BoxedMap(val data: FrozenMap) : IfAndThenWithoutElse1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IfAndThenWithoutElse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .then(Then::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfAndThenWithoutElse1BoxedList>, MapSchemaValidator, IfAndThenWithoutElse1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IfAndThenWithoutElse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfAndThenWithoutElse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedVoid { + return IfAndThenWithoutElse1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedBoolean { + return IfAndThenWithoutElse1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedNumber { + return IfAndThenWithoutElse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedString { + return IfAndThenWithoutElse1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedList { + return IfAndThenWithoutElse1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfAndThenWithoutElse1BoxedMap { + return IfAndThenWithoutElse1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfAndThenWithoutElse1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt new file mode 100644 index 00000000000..eb0d78fc9e7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.kt @@ -0,0 +1,1153 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence { + // nest classes so all schemas and input/output classes can be public + + enum class StringElseConst(private val value: String): StringValueMethod { + OTHER("other"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("other") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + enum class StringThenConst(private val value: String): StringValueMethod { + YES("yes"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("yes") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + fun getData(): Any? + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid(val data: Nothing?) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean(val data: Boolean): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber(val data: Number) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString(val data: String) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList(val data: FrozenList) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap(val data: FrozenMap) : IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .then(Then::class.java) + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList>, MapSchemaValidator, IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap { + return IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt new file mode 100644 index 00000000000..7610aa55b60 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIf.kt @@ -0,0 +1,593 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IgnoreElseWithoutIf { + // nest classes so all schemas and input/output classes can be public + + enum class StringElseConst(private val value: String): StringValueMethod { + POSITIVE_0("0"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("0") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IgnoreElseWithoutIf1Boxed { + fun getData(): Any? + } + + data class IgnoreElseWithoutIf1BoxedVoid(val data: Nothing?) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedBoolean(val data: Boolean): IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedNumber(val data: Number) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedString(val data: String) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedList(val data: FrozenList) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreElseWithoutIf1BoxedMap(val data: FrozenMap) : IgnoreElseWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IgnoreElseWithoutIf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IgnoreElseWithoutIf1BoxedList>, MapSchemaValidator, IgnoreElseWithoutIf1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IgnoreElseWithoutIf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IgnoreElseWithoutIf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedVoid { + return IgnoreElseWithoutIf1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedBoolean { + return IgnoreElseWithoutIf1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedNumber { + return IgnoreElseWithoutIf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedString { + return IgnoreElseWithoutIf1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedList { + return IgnoreElseWithoutIf1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1BoxedMap { + return IgnoreElseWithoutIf1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IgnoreElseWithoutIf1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt new file mode 100644 index 00000000000..da5da5f2289 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElse.kt @@ -0,0 +1,593 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IgnoreIfWithoutThenOrElse { + // nest classes so all schemas and input/output classes can be public + + enum class StringIfConst(private val value: String): StringValueMethod { + POSITIVE_0("0"); + + override fun value(): String { + return this.value + } + } + + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("0") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IgnoreIfWithoutThenOrElse1Boxed { + fun getData(): Any? + } + + data class IgnoreIfWithoutThenOrElse1BoxedVoid(val data: Nothing?) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedBoolean(val data: Boolean): IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedNumber(val data: Number) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedString(val data: String) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedList(val data: FrozenList) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreIfWithoutThenOrElse1BoxedMap(val data: FrozenMap) : IgnoreIfWithoutThenOrElse1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IgnoreIfWithoutThenOrElse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IgnoreIfWithoutThenOrElse1BoxedList>, MapSchemaValidator, IgnoreIfWithoutThenOrElse1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IgnoreIfWithoutThenOrElse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IgnoreIfWithoutThenOrElse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedVoid { + return IgnoreIfWithoutThenOrElse1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedBoolean { + return IgnoreIfWithoutThenOrElse1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedNumber { + return IgnoreIfWithoutThenOrElse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedString { + return IgnoreIfWithoutThenOrElse1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedList { + return IgnoreIfWithoutThenOrElse1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1BoxedMap { + return IgnoreIfWithoutThenOrElse1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IgnoreIfWithoutThenOrElse1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt new file mode 100644 index 00000000000..42d529dfc20 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIf.kt @@ -0,0 +1,593 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IgnoreThenWithoutIf { + // nest classes so all schemas and input/output classes can be public + + enum class StringThenConst(private val value: String): StringValueMethod { + POSITIVE_0("0"); + + override fun value(): String { + return this.value + } + } + + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .constValue("0") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IgnoreThenWithoutIf1Boxed { + fun getData(): Any? + } + + data class IgnoreThenWithoutIf1BoxedVoid(val data: Nothing?) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedBoolean(val data: Boolean): IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedNumber(val data: Number) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedString(val data: String) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedList(val data: FrozenList) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IgnoreThenWithoutIf1BoxedMap(val data: FrozenMap) : IgnoreThenWithoutIf1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IgnoreThenWithoutIf1 private constructor(): JsonSchema( + JsonSchemaInfo() + .then(Then::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IgnoreThenWithoutIf1BoxedList>, MapSchemaValidator, IgnoreThenWithoutIf1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IgnoreThenWithoutIf1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IgnoreThenWithoutIf1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedVoid { + return IgnoreThenWithoutIf1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedBoolean { + return IgnoreThenWithoutIf1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedNumber { + return IgnoreThenWithoutIf1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedString { + return IgnoreThenWithoutIf1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedList { + return IgnoreThenWithoutIf1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1BoxedMap { + return IgnoreThenWithoutIf1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IgnoreThenWithoutIf1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt new file mode 100644 index 00000000000..fef4eb00f39 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.IntJsonSchema + +class IntegerTypeMatchesIntegers: IntJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class IntegerTypeMatchesIntegers1 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: IntegerTypeMatchesIntegers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntegerTypeMatchesIntegers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt new file mode 100644 index 00000000000..6daf2520bd4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv4Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv4Format1Boxed { + fun getData(): Any? + } + + data class Ipv4Format1BoxedVoid(val data: Nothing?) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedBoolean(val data: Boolean): Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedNumber(val data: Number) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedString(val data: String) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedList(val data: FrozenList) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv4Format1BoxedMap(val data: FrozenMap) : Ipv4Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv4Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv4") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv4Format1BoxedList>, MapSchemaValidator, Ipv4Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv4Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv4Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv4Format1BoxedVoid { + return Ipv4Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv4Format1BoxedBoolean { + return Ipv4Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv4Format1BoxedNumber { + return Ipv4Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv4Format1BoxedString { + return Ipv4Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv4Format1BoxedList { + return Ipv4Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv4Format1BoxedMap { + return Ipv4Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv4Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt new file mode 100644 index 00000000000..e08e410e9ea --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6Format.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Ipv6Format { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Ipv6Format1Boxed { + fun getData(): Any? + } + + data class Ipv6Format1BoxedVoid(val data: Nothing?) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedBoolean(val data: Boolean): Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedNumber(val data: Number) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedString(val data: String) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedList(val data: FrozenList) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Ipv6Format1BoxedMap(val data: FrozenMap) : Ipv6Format1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Ipv6Format1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("ipv6") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Ipv6Format1BoxedList>, MapSchemaValidator, Ipv6Format1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Ipv6Format1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ipv6Format1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Ipv6Format1BoxedVoid { + return Ipv6Format1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Ipv6Format1BoxedBoolean { + return Ipv6Format1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Ipv6Format1BoxedNumber { + return Ipv6Format1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Ipv6Format1BoxedString { + return Ipv6Format1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Ipv6Format1BoxedList { + return Ipv6Format1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Ipv6Format1BoxedMap { + return Ipv6Format1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Ipv6Format1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt new file mode 100644 index 00000000000..bdb0007d2fa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IriFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IriFormat1Boxed { + fun getData(): Any? + } + + data class IriFormat1BoxedVoid(val data: Nothing?) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedBoolean(val data: Boolean): IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedNumber(val data: Number) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedString(val data: String) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedList(val data: FrozenList) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriFormat1BoxedMap(val data: FrozenMap) : IriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IriFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("iri") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IriFormat1BoxedList>, MapSchemaValidator, IriFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IriFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IriFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IriFormat1BoxedVoid { + return IriFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IriFormat1BoxedBoolean { + return IriFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IriFormat1BoxedNumber { + return IriFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IriFormat1BoxedString { + return IriFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IriFormat1BoxedList { + return IriFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IriFormat1BoxedMap { + return IriFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IriFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt new file mode 100644 index 00000000000..3fe9a4c9bdf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class IriReferenceFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IriReferenceFormat1Boxed { + fun getData(): Any? + } + + data class IriReferenceFormat1BoxedVoid(val data: Nothing?) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedBoolean(val data: Boolean): IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedNumber(val data: Number) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedString(val data: String) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedList(val data: FrozenList) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class IriReferenceFormat1BoxedMap(val data: FrozenMap) : IriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class IriReferenceFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("iri-reference") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IriReferenceFormat1BoxedList>, MapSchemaValidator, IriReferenceFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: IriReferenceFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IriReferenceFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedVoid { + return IriReferenceFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedBoolean { + return IriReferenceFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedNumber { + return IriReferenceFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedString { + return IriReferenceFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedList { + return IriReferenceFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IriReferenceFormat1BoxedMap { + return IriReferenceFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IriReferenceFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt new file mode 100644 index 00000000000..1a2688f77d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContains.kt @@ -0,0 +1,737 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ItemsContains { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ContainsBoxed { + fun getData(): Any? + } + + data class ContainsBoxedVoid(val data: Nothing?) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedBoolean(val data: Boolean): ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedNumber(val data: Number) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedString(val data: String) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedList(val data: FrozenList) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedMap(val data: FrozenMap) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Contains private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsBoxedList>, MapSchemaValidator, ContainsBoxedMap> { + + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsBoxedVoid { + return ContainsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsBoxedBoolean { + return ContainsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsBoxedNumber { + return ContainsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsBoxedString { + return ContainsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsBoxedList { + return ContainsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsBoxedMap { + return ContainsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedVoid(val data: Nothing?) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedBoolean(val data: Boolean): ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedNumber(val data: Number) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedString(val data: String) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedList(val data: FrozenList) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedMap(val data: FrozenMap) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ItemsBoxedList>, MapSchemaValidator, ItemsBoxedMap> { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ItemsBoxedVoid { + return ItemsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ItemsBoxedBoolean { + return ItemsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ItemsBoxedNumber { + return ItemsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ItemsBoxedString { + return ItemsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ItemsBoxedMap { + return ItemsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsContainsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsContainsList { + return ItemsContains1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsContainsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ItemsContainsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: String): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ItemsContainsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ItemsContains1Boxed { + fun getData(): Any? + } + + data class ItemsContains1BoxedList(val data: ItemsContainsList) : ItemsContains1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ItemsContains1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + .contains(Contains::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ItemsContains1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ItemsContains1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsContainsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsContainsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsContainsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsContains1BoxedList { + return ItemsContains1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsContains1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt new file mode 100644 index 00000000000..3a2af1e507c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCase.kt @@ -0,0 +1,460 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ItemsDoesNotLookInApplicatorsValidCase { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedVoid(val data: Nothing?) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedBoolean(val data: Boolean): ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedNumber(val data: Number) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedString(val data: String) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedList(val data: FrozenList) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ItemsBoxedMap(val data: FrozenMap) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(5) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ItemsBoxedList>, MapSchemaValidator, ItemsBoxedMap> { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ItemsBoxedVoid { + return ItemsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ItemsBoxedBoolean { + return ItemsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ItemsBoxedNumber { + return ItemsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ItemsBoxedString { + return ItemsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ItemsBoxedMap { + return ItemsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsDoesNotLookInApplicatorsValidCaseList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCaseList { + return ItemsDoesNotLookInApplicatorsValidCase1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: String): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Int): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun add(item: Map): ItemsDoesNotLookInApplicatorsValidCaseListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ItemsDoesNotLookInApplicatorsValidCase1Boxed { + fun getData(): Any? + } + + data class ItemsDoesNotLookInApplicatorsValidCase1BoxedList(val data: ItemsDoesNotLookInApplicatorsValidCaseList) : ItemsDoesNotLookInApplicatorsValidCase1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ItemsDoesNotLookInApplicatorsValidCase1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ItemsDoesNotLookInApplicatorsValidCase1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ItemsDoesNotLookInApplicatorsValidCase1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsDoesNotLookInApplicatorsValidCaseList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsDoesNotLookInApplicatorsValidCaseList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCaseList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCase1BoxedList { + return ItemsDoesNotLookInApplicatorsValidCase1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsDoesNotLookInApplicatorsValidCase1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt new file mode 100644 index 00000000000..9b289cfe5c4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElements.kt @@ -0,0 +1,150 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ItemsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class Items : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class ItemsWithNullInstanceElementsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsWithNullInstanceElementsList { + return ItemsWithNullInstanceElements1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsWithNullInstanceElementsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): ItemsWithNullInstanceElementsListBuilder { + list.add(null) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface ItemsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class ItemsWithNullInstanceElements1BoxedList(val data: ItemsWithNullInstanceElementsList) : ItemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class ItemsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ItemsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ItemsWithNullInstanceElements1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsWithNullInstanceElementsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance == null || itemInstance is Nothing?)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsWithNullInstanceElementsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsWithNullInstanceElementsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsWithNullInstanceElements1BoxedList { + return ItemsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsWithNullInstanceElements1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt new file mode 100644 index 00000000000..b45b9ad16a2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class JsonPointerFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface JsonPointerFormat1Boxed { + fun getData(): Any? + } + + data class JsonPointerFormat1BoxedVoid(val data: Nothing?) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedBoolean(val data: Boolean): JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedNumber(val data: Number) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedString(val data: String) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedList(val data: FrozenList) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class JsonPointerFormat1BoxedMap(val data: FrozenMap) : JsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class JsonPointerFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("json-pointer") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, JsonPointerFormat1BoxedList>, MapSchemaValidator, JsonPointerFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: JsonPointerFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: JsonPointerFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedVoid { + return JsonPointerFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedBoolean { + return JsonPointerFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedNumber { + return JsonPointerFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedString { + return JsonPointerFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedList { + return JsonPointerFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): JsonPointerFormat1BoxedMap { + return JsonPointerFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): JsonPointerFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt new file mode 100644 index 00000000000..8aabb923c5a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnored.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxcontainsWithoutContainsIsIgnored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxcontainsWithoutContainsIsIgnored1Boxed { + fun getData(): Any? + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedVoid(val data: Nothing?) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedBoolean(val data: Boolean): MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedNumber(val data: Number) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedString(val data: String) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedList(val data: FrozenList) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxcontainsWithoutContainsIsIgnored1BoxedMap(val data: FrozenMap) : MaxcontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxcontainsWithoutContainsIsIgnored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxContains(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxcontainsWithoutContainsIsIgnored1BoxedList>, MapSchemaValidator, MaxcontainsWithoutContainsIsIgnored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxcontainsWithoutContainsIsIgnored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxcontainsWithoutContainsIsIgnored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedVoid { + return MaxcontainsWithoutContainsIsIgnored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedBoolean { + return MaxcontainsWithoutContainsIsIgnored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedNumber { + return MaxcontainsWithoutContainsIsIgnored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedString { + return MaxcontainsWithoutContainsIsIgnored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedList { + return MaxcontainsWithoutContainsIsIgnored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1BoxedMap { + return MaxcontainsWithoutContainsIsIgnored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxcontainsWithoutContainsIsIgnored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt new file mode 100644 index 00000000000..46d8b221c64 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidation1Boxed { + fun getData(): Any? + } + + data class MaximumValidation1BoxedVoid(val data: Nothing?) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedBoolean(val data: Boolean): MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedNumber(val data: Number) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedString(val data: String) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedList(val data: FrozenList) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidation1BoxedMap(val data: FrozenMap) : MaximumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(3.0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidation1BoxedList>, MapSchemaValidator, MaximumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidation1BoxedVoid { + return MaximumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidation1BoxedBoolean { + return MaximumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidation1BoxedNumber { + return MaximumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidation1BoxedString { + return MaximumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidation1BoxedList { + return MaximumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidation1BoxedMap { + return MaximumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt new file mode 100644 index 00000000000..49da0ee99a0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaximumValidationWithUnsignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaximumValidationWithUnsignedInteger1Boxed { + fun getData(): Any? + } + + data class MaximumValidationWithUnsignedInteger1BoxedVoid(val data: Nothing?) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedBoolean(val data: Boolean): MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedNumber(val data: Number) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedString(val data: String) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedList(val data: FrozenList) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaximumValidationWithUnsignedInteger1BoxedMap(val data: FrozenMap) : MaximumValidationWithUnsignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaximumValidationWithUnsignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(300) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedList>, MapSchemaValidator, MaximumValidationWithUnsignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaximumValidationWithUnsignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaximumValidationWithUnsignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedVoid { + return MaximumValidationWithUnsignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedBoolean { + return MaximumValidationWithUnsignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedNumber { + return MaximumValidationWithUnsignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedString { + return MaximumValidationWithUnsignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedList { + return MaximumValidationWithUnsignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1BoxedMap { + return MaximumValidationWithUnsignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaximumValidationWithUnsignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt new file mode 100644 index 00000000000..1f763f7719f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxitemsValidation1Boxed { + fun getData(): Any? + } + + data class MaxitemsValidation1BoxedVoid(val data: Nothing?) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedBoolean(val data: Boolean): MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedNumber(val data: Number) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedString(val data: String) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedList(val data: FrozenList) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxitemsValidation1BoxedMap(val data: FrozenMap) : MaxitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxItems(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxitemsValidation1BoxedList>, MapSchemaValidator, MaxitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedVoid { + return MaxitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedBoolean { + return MaxitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedNumber { + return MaxitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedString { + return MaxitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedList { + return MaxitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxitemsValidation1BoxedMap { + return MaxitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt new file mode 100644 index 00000000000..ba1e070bc6f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxlengthValidation1Boxed { + fun getData(): Any? + } + + data class MaxlengthValidation1BoxedVoid(val data: Nothing?) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedBoolean(val data: Boolean): MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedNumber(val data: Number) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedString(val data: String) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedList(val data: FrozenList) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxlengthValidation1BoxedMap(val data: FrozenMap) : MaxlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxlengthValidation1BoxedList>, MapSchemaValidator, MaxlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedVoid { + return MaxlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedBoolean { + return MaxlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedNumber { + return MaxlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedString { + return MaxlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedList { + return MaxlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxlengthValidation1BoxedMap { + return MaxlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt new file mode 100644 index 00000000000..62b6deb1e2e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmpty.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Maxproperties0MeansTheObjectIsEmpty { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Maxproperties0MeansTheObjectIsEmpty1Boxed { + fun getData(): Any? + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(val data: Nothing?) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(val data: Boolean): Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(val data: Number) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedString(val data: String) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedList(val data: FrozenList) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Maxproperties0MeansTheObjectIsEmpty1BoxedMap(val data: FrozenMap) : Maxproperties0MeansTheObjectIsEmpty1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Maxproperties0MeansTheObjectIsEmpty1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedList>, MapSchemaValidator, Maxproperties0MeansTheObjectIsEmpty1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Maxproperties0MeansTheObjectIsEmpty1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Maxproperties0MeansTheObjectIsEmpty1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedVoid { + return Maxproperties0MeansTheObjectIsEmpty1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean { + return Maxproperties0MeansTheObjectIsEmpty1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedNumber { + return Maxproperties0MeansTheObjectIsEmpty1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedString { + return Maxproperties0MeansTheObjectIsEmpty1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedList { + return Maxproperties0MeansTheObjectIsEmpty1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1BoxedMap { + return Maxproperties0MeansTheObjectIsEmpty1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Maxproperties0MeansTheObjectIsEmpty1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt new file mode 100644 index 00000000000..4605f17fd0e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MaxpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MaxpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MaxpropertiesValidation1BoxedVoid(val data: Nothing?) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedBoolean(val data: Boolean): MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedNumber(val data: Number) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedString(val data: String) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedList(val data: FrozenList) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MaxpropertiesValidation1BoxedMap(val data: FrozenMap) : MaxpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MaxpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxProperties(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MaxpropertiesValidation1BoxedList>, MapSchemaValidator, MaxpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MaxpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MaxpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedVoid { + return MaxpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedBoolean { + return MaxpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedNumber { + return MaxpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedString { + return MaxpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedList { + return MaxpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MaxpropertiesValidation1BoxedMap { + return MaxpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MaxpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt new file mode 100644 index 00000000000..20899b8d90b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnored.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MincontainsWithoutContainsIsIgnored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MincontainsWithoutContainsIsIgnored1Boxed { + fun getData(): Any? + } + + data class MincontainsWithoutContainsIsIgnored1BoxedVoid(val data: Nothing?) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedBoolean(val data: Boolean): MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedNumber(val data: Number) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedString(val data: String) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedList(val data: FrozenList) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MincontainsWithoutContainsIsIgnored1BoxedMap(val data: FrozenMap) : MincontainsWithoutContainsIsIgnored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MincontainsWithoutContainsIsIgnored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minContains(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MincontainsWithoutContainsIsIgnored1BoxedList>, MapSchemaValidator, MincontainsWithoutContainsIsIgnored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MincontainsWithoutContainsIsIgnored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MincontainsWithoutContainsIsIgnored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedVoid { + return MincontainsWithoutContainsIsIgnored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedBoolean { + return MincontainsWithoutContainsIsIgnored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedNumber { + return MincontainsWithoutContainsIsIgnored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedString { + return MincontainsWithoutContainsIsIgnored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedList { + return MincontainsWithoutContainsIsIgnored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1BoxedMap { + return MincontainsWithoutContainsIsIgnored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MincontainsWithoutContainsIsIgnored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt new file mode 100644 index 00000000000..93c46043a0f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidation1Boxed { + fun getData(): Any? + } + + data class MinimumValidation1BoxedVoid(val data: Nothing?) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedBoolean(val data: Boolean): MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedNumber(val data: Number) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedString(val data: String) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedList(val data: FrozenList) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidation1BoxedMap(val data: FrozenMap) : MinimumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(1.1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidation1BoxedList>, MapSchemaValidator, MinimumValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidation1BoxedVoid { + return MinimumValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidation1BoxedBoolean { + return MinimumValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidation1BoxedNumber { + return MinimumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidation1BoxedString { + return MinimumValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidation1BoxedList { + return MinimumValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidation1BoxedMap { + return MinimumValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt new file mode 100644 index 00000000000..d6d1593b716 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedInteger.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinimumValidationWithSignedInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinimumValidationWithSignedInteger1Boxed { + fun getData(): Any? + } + + data class MinimumValidationWithSignedInteger1BoxedVoid(val data: Nothing?) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedBoolean(val data: Boolean): MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedNumber(val data: Number) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedString(val data: String) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedList(val data: FrozenList) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinimumValidationWithSignedInteger1BoxedMap(val data: FrozenMap) : MinimumValidationWithSignedInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinimumValidationWithSignedInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinimumValidationWithSignedInteger1BoxedList>, MapSchemaValidator, MinimumValidationWithSignedInteger1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinimumValidationWithSignedInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinimumValidationWithSignedInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedVoid { + return MinimumValidationWithSignedInteger1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedBoolean { + return MinimumValidationWithSignedInteger1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedNumber { + return MinimumValidationWithSignedInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedString { + return MinimumValidationWithSignedInteger1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedList { + return MinimumValidationWithSignedInteger1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1BoxedMap { + return MinimumValidationWithSignedInteger1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinimumValidationWithSignedInteger1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt new file mode 100644 index 00000000000..bc2ce6d4c65 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinitemsValidation1Boxed { + fun getData(): Any? + } + + data class MinitemsValidation1BoxedVoid(val data: Nothing?) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedBoolean(val data: Boolean): MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedNumber(val data: Number) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedString(val data: String) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedList(val data: FrozenList) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinitemsValidation1BoxedMap(val data: FrozenMap) : MinitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minItems(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinitemsValidation1BoxedList>, MapSchemaValidator, MinitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinitemsValidation1BoxedVoid { + return MinitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinitemsValidation1BoxedBoolean { + return MinitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinitemsValidation1BoxedNumber { + return MinitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinitemsValidation1BoxedString { + return MinitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedList { + return MinitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinitemsValidation1BoxedMap { + return MinitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt new file mode 100644 index 00000000000..2e7b4c422ee --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinlengthValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinlengthValidation1Boxed { + fun getData(): Any? + } + + data class MinlengthValidation1BoxedVoid(val data: Nothing?) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedBoolean(val data: Boolean): MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedNumber(val data: Number) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedString(val data: String) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedList(val data: FrozenList) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinlengthValidation1BoxedMap(val data: FrozenMap) : MinlengthValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinlengthValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinlengthValidation1BoxedList>, MapSchemaValidator, MinlengthValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinlengthValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinlengthValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinlengthValidation1BoxedVoid { + return MinlengthValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinlengthValidation1BoxedBoolean { + return MinlengthValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinlengthValidation1BoxedNumber { + return MinlengthValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinlengthValidation1BoxedString { + return MinlengthValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedList { + return MinlengthValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinlengthValidation1BoxedMap { + return MinlengthValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinlengthValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt new file mode 100644 index 00000000000..bb29435be31 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MinpropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MinpropertiesValidation1Boxed { + fun getData(): Any? + } + + data class MinpropertiesValidation1BoxedVoid(val data: Nothing?) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedBoolean(val data: Boolean): MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedNumber(val data: Number) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedString(val data: String) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedList(val data: FrozenList) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MinpropertiesValidation1BoxedMap(val data: FrozenMap) : MinpropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MinpropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minProperties(1) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MinpropertiesValidation1BoxedList>, MapSchemaValidator, MinpropertiesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MinpropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MinpropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedVoid { + return MinpropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedBoolean { + return MinpropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedNumber { + return MinpropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedString { + return MinpropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedList { + return MinpropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MinpropertiesValidation1BoxedMap { + return MinpropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MinpropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt new file mode 100644 index 00000000000..e9c802a29f2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequired.kt @@ -0,0 +1,318 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MultipleDependentsRequired { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MultipleDependentsRequired1Boxed { + fun getData(): Any? + } + + data class MultipleDependentsRequired1BoxedVoid(val data: Nothing?) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedBoolean(val data: Boolean): MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedNumber(val data: Number) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedString(val data: String) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedList(val data: FrozenList) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleDependentsRequired1BoxedMap(val data: FrozenMap) : MultipleDependentsRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MultipleDependentsRequired1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentRequired(mapOf( + Pair( + "quux", + setOf( + "foo", + "bar" + ) + ) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipleDependentsRequired1BoxedList>, MapSchemaValidator, MultipleDependentsRequired1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MultipleDependentsRequired1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MultipleDependentsRequired1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedVoid { + return MultipleDependentsRequired1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedBoolean { + return MultipleDependentsRequired1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedNumber { + return MultipleDependentsRequired1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedString { + return MultipleDependentsRequired1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedList { + return MultipleDependentsRequired1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MultipleDependentsRequired1BoxedMap { + return MultipleDependentsRequired1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MultipleDependentsRequired1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt new file mode 100644 index 00000000000..1b940fd9ad8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidated.kt @@ -0,0 +1,602 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MultipleSimultaneousPatternpropertiesAreValidated { + // nest classes so all schemas and input/output classes can be public + + + class A : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: A? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: A().also { instance = it } + } + } + } + + + sealed interface AaaBoxed { + fun getData(): Any? + } + + data class AaaBoxedVoid(val data: Nothing?) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedBoolean(val data: Boolean): AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedNumber(val data: Number) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedString(val data: String) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedList(val data: FrozenList) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + data class AaaBoxedMap(val data: FrozenMap) : AaaBoxed { + override fun getData(): Any? { + return data + } + } + + + class Aaa private constructor(): JsonSchema( + JsonSchemaInfo() + .maximum(20) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, AaaBoxedList>, MapSchemaValidator, AaaBoxedMap> { + + companion object { + @Volatile + private var instance: Aaa? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Aaa().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AaaBoxedVoid { + return AaaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AaaBoxedBoolean { + return AaaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AaaBoxedNumber { + return AaaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AaaBoxedString { + return AaaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AaaBoxedList { + return AaaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AaaBoxedMap { + return AaaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AaaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + fun getData(): Any? + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid(val data: Nothing?) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean(val data: Boolean): MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber(val data: Number) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedString(val data: String) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedList(val data: FrozenList) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap(val data: FrozenMap) : MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + override fun getData(): Any? { + return data + } + } + + + class MultipleSimultaneousPatternpropertiesAreValidated1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + Pattern.compile("a*") to A::class.java, + Pattern.compile("aaa*") to Aaa::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MultipleSimultaneousPatternpropertiesAreValidated1BoxedList>, MapSchemaValidator, MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MultipleSimultaneousPatternpropertiesAreValidated1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MultipleSimultaneousPatternpropertiesAreValidated1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedString { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedList { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap { + return MultipleSimultaneousPatternpropertiesAreValidated1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MultipleSimultaneousPatternpropertiesAreValidated1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt new file mode 100644 index 00000000000..9c1dfe90e77 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArray.kt @@ -0,0 +1,139 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class MultipleTypesCanBeSpecifiedInAnArray { + // nest classes so all schemas and input/output classes can be public + + + sealed interface MultipleTypesCanBeSpecifiedInAnArray1Boxed { + fun getData(): Any? + } + + data class MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber(val data: Number) : MultipleTypesCanBeSpecifiedInAnArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class MultipleTypesCanBeSpecifiedInAnArray1BoxedString(val data: String) : MultipleTypesCanBeSpecifiedInAnArray1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class MultipleTypesCanBeSpecifiedInAnArray1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java, + String::class.java + )) + .format("int") + ), NumberSchemaValidator, StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: MultipleTypesCanBeSpecifiedInAnArray1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MultipleTypesCanBeSpecifiedInAnArray1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber { + return MultipleTypesCanBeSpecifiedInAnArray1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): MultipleTypesCanBeSpecifiedInAnArray1BoxedString { + return MultipleTypesCanBeSpecifiedInAnArray1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MultipleTypesCanBeSpecifiedInAnArray1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..d2e2c14ae94 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAllofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAllofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAllofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedString(val data: String) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAllofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAllofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAllofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAllofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAllofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAllofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedVoid { + return NestedAllofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedBoolean { + return NestedAllofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedNumber { + return NestedAllofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedString { + return NestedAllofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedList { + return NestedAllofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1BoxedMap { + return NestedAllofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAllofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..df6ba63b7b6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedAnyofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedAnyofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedAnyofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedString(val data: String) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedAnyofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedAnyofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedAnyofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .anyOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedAnyofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedAnyofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedAnyofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedVoid { + return NestedAnyofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedBoolean { + return NestedAnyofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedNumber { + return NestedAnyofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedString { + return NestedAnyofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedList { + return NestedAnyofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1BoxedMap { + return NestedAnyofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedAnyofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt new file mode 100644 index 00000000000..27acba2e66d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedItems.kt @@ -0,0 +1,510 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedItems { + // nest classes so all schemas and input/output classes can be public + + + class Items3 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Items3? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items3().also { instance = it } + } + } + } + + + class ItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ItemsList { + return Items2.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): ItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): ItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + sealed interface Items2Boxed { + fun getData(): Any? + } + + data class Items2BoxedList(val data: ItemsList) : Items2Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items2 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items3::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items2().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Number)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items2BoxedList { + return Items2BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items2Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList1(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>, configuration: SchemaConfiguration?): ItemsList1 { + return Items1.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder1 { + // class to build List> + private val list: MutableList> + + init { + this.list = ArrayList() + } + + + fun add(item: List): ItemsListBuilder1 { + list.add(item) + return this + } + + fun build(): List> { + return list + } + } + + + sealed interface Items1Boxed { + fun getData(): Any? + } + + data class Items1BoxedList(val data: ItemsList1) : Items1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class Items1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items2::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList1 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList1(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList1 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Items1BoxedList { + return Items1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Items1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ItemsList2(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>, configuration: SchemaConfiguration?): ItemsList2 { + return Items.getInstance().validate(arg, configuration) + } + } + } + + class ItemsListBuilder2 { + // class to build List>> + private val list: MutableList>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>): ItemsListBuilder2 { + list.add(item) + return this + } + + fun build(): List>> { + return list + } + } + + + sealed interface ItemsBoxed { + fun getData(): Any? + } + + data class ItemsBoxedList(val data: ItemsList2) : ItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Items private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items1::class.java) + ), ListSchemaValidator { + + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): ItemsList2 { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList1)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return ItemsList2(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ItemsList2 { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ItemsBoxedList { + return ItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ItemsBoxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class NestedItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List>>>, configuration: SchemaConfiguration?): NestedItemsList { + return NestedItems1.getInstance().validate(arg, configuration) + } + } + } + + class NestedItemsListBuilder { + // class to build List>>> + private val list: MutableList>>> + + init { + this.list = ArrayList() + } + + + fun add(item: List>>): NestedItemsListBuilder { + list.add(item) + return this + } + + fun build(): List>>> { + return list + } + } + + + sealed interface NestedItems1Boxed { + fun getData(): Any? + } + + data class NestedItems1BoxedList(val data: NestedItemsList) : NestedItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NestedItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): NestedItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is ItemsList2)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return NestedItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): NestedItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedItems1BoxedList { + return NestedItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt new file mode 100644 index 00000000000..eaaadf832d1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemantics.kt @@ -0,0 +1,601 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NestedOneofToCheckValidationSemantics { + // nest classes so all schemas and input/output classes can be public + + + class Schema01 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema01? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema01().also { instance = it } + } + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema01::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NestedOneofToCheckValidationSemantics1Boxed { + fun getData(): Any? + } + + data class NestedOneofToCheckValidationSemantics1BoxedVoid(val data: Nothing?) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedBoolean(val data: Boolean): NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedNumber(val data: Number) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedString(val data: String) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedList(val data: FrozenList) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NestedOneofToCheckValidationSemantics1BoxedMap(val data: FrozenMap) : NestedOneofToCheckValidationSemantics1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NestedOneofToCheckValidationSemantics1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedList>, MapSchemaValidator, NestedOneofToCheckValidationSemantics1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NestedOneofToCheckValidationSemantics1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NestedOneofToCheckValidationSemantics1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedVoid { + return NestedOneofToCheckValidationSemantics1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedBoolean { + return NestedOneofToCheckValidationSemantics1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedNumber { + return NestedOneofToCheckValidationSemantics1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedString { + return NestedOneofToCheckValidationSemantics1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedList { + return NestedOneofToCheckValidationSemantics1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1BoxedMap { + return NestedOneofToCheckValidationSemantics1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NestedOneofToCheckValidationSemantics1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt new file mode 100644 index 00000000000..70c07dad448 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalproperties.kt @@ -0,0 +1,166 @@ +package org.openapijsonschematools.client.components.schemas +import java.util.AbstractMap +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NonAsciiPatternWithAdditionalproperties { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class CircumflexAccentLatinSmallLetterAWithAcute : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: CircumflexAccentLatinSmallLetterAWithAcute? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: CircumflexAccentLatinSmallLetterAWithAcute().also { instance = it } + } + } + } + + + class NonAsciiPatternWithAdditionalpropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf() + // map with no key value pairs + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): NonAsciiPatternWithAdditionalpropertiesMap { + return NonAsciiPatternWithAdditionalproperties1.getInstance().validate(arg, configuration) + } + } + } + + class NonAsciiPatternWithAdditionalpropertiesMapBuilder: GenericBuilder> { + private val knownKeys: Set = setOf() + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + } + + + sealed interface NonAsciiPatternWithAdditionalproperties1Boxed { + fun getData(): Any? + } + + data class NonAsciiPatternWithAdditionalproperties1BoxedMap(val data: NonAsciiPatternWithAdditionalpropertiesMap) : NonAsciiPatternWithAdditionalproperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NonAsciiPatternWithAdditionalproperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(AdditionalProperties::class.java) + .patternProperties(mapOf( + Pattern.compile("^á") to CircumflexAccentLatinSmallLetterAWithAcute::class.java + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NonAsciiPatternWithAdditionalproperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NonAsciiPatternWithAdditionalproperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): NonAsciiPatternWithAdditionalpropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return NonAsciiPatternWithAdditionalpropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): NonAsciiPatternWithAdditionalpropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NonAsciiPatternWithAdditionalproperties1BoxedMap { + return NonAsciiPatternWithAdditionalproperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NonAsciiPatternWithAdditionalproperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt new file mode 100644 index 00000000000..15b1a75e9c7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemas.kt @@ -0,0 +1,1963 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NonInterferenceAcrossCombinedSchemas { + // nest classes so all schemas and input/output classes can be public + + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-10) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .then(Then::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema2Boxed { + fun getData(): Any? + } + + data class Schema2BoxedVoid(val data: Nothing?) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedBoolean(val data: Boolean): Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedNumber(val data: Number) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedString(val data: String) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedList(val data: FrozenList) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema2BoxedMap(val data: FrozenMap) : Schema2Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema2 private constructor(): JsonSchema( + JsonSchemaInfo() + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema2BoxedList>, MapSchemaValidator, Schema2BoxedMap> { + + companion object { + @Volatile + private var instance: Schema2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema2().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema2BoxedVoid { + return Schema2BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema2BoxedBoolean { + return Schema2BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema2BoxedNumber { + return Schema2BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema2BoxedString { + return Schema2BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema2BoxedList { + return Schema2BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema2BoxedMap { + return Schema2BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema2Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NonInterferenceAcrossCombinedSchemas1Boxed { + fun getData(): Any? + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedVoid(val data: Nothing?) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedBoolean(val data: Boolean): NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedNumber(val data: Number) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedString(val data: String) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedList(val data: FrozenList) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NonInterferenceAcrossCombinedSchemas1BoxedMap(val data: FrozenMap) : NonInterferenceAcrossCombinedSchemas1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NonInterferenceAcrossCombinedSchemas1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java, + Schema2::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NonInterferenceAcrossCombinedSchemas1BoxedList>, MapSchemaValidator, NonInterferenceAcrossCombinedSchemas1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NonInterferenceAcrossCombinedSchemas1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NonInterferenceAcrossCombinedSchemas1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedVoid { + return NonInterferenceAcrossCombinedSchemas1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedBoolean { + return NonInterferenceAcrossCombinedSchemas1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedNumber { + return NonInterferenceAcrossCombinedSchemas1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedString { + return NonInterferenceAcrossCombinedSchemas1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedList { + return NonInterferenceAcrossCombinedSchemas1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1BoxedMap { + return NonInterferenceAcrossCombinedSchemas1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NonInterferenceAcrossCombinedSchemas1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt new file mode 100644 index 00000000000..96a1a64a1be --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Not.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Not { + // nest classes so all schemas and input/output classes can be public + + + class Not2 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Not2? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not2().also { instance = it } + } + } + } + + + sealed interface Not1Boxed { + fun getData(): Any? + } + + data class Not1BoxedVoid(val data: Nothing?) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedBoolean(val data: Boolean): Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedNumber(val data: Number) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedString(val data: String) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedList(val data: FrozenList) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Not1BoxedMap(val data: FrozenMap) : Not1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Not1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not2::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Not1BoxedList>, MapSchemaValidator, Not1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Not1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Not1BoxedVoid { + return Not1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Not1BoxedBoolean { + return Not1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Not1BoxedNumber { + return Not1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Not1BoxedString { + return Not1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Not1BoxedList { + return Not1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Not1BoxedMap { + return Not1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Not1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt new file mode 100644 index 00000000000..70fae92a396 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchema.kt @@ -0,0 +1,478 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NotMoreComplexSchema { + // nest classes so all schemas and input/output classes can be public + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class NotMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): NotMap { + return Not.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class NotMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): NotMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): NotMapBuilder { + return this + } + } + + + sealed interface NotBoxed { + fun getData(): Any? + } + + data class NotBoxedMap(val data: NotMap) : NotBoxed { + override fun getData(): Any? { + return data + } + } + + + class Not private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java + )) + ), MapSchemaValidator { + + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): NotMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return NotMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotBoxedMap { + return NotBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotBoxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + + sealed interface NotMoreComplexSchema1Boxed { + fun getData(): Any? + } + + data class NotMoreComplexSchema1BoxedVoid(val data: Nothing?) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedBoolean(val data: Boolean): NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedNumber(val data: Number) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedString(val data: String) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedList(val data: FrozenList) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMoreComplexSchema1BoxedMap(val data: FrozenMap) : NotMoreComplexSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NotMoreComplexSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotMoreComplexSchema1BoxedList>, MapSchemaValidator, NotMoreComplexSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NotMoreComplexSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NotMoreComplexSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedVoid { + return NotMoreComplexSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedBoolean { + return NotMoreComplexSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedNumber { + return NotMoreComplexSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedString { + return NotMoreComplexSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedList { + return NotMoreComplexSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMoreComplexSchema1BoxedMap { + return NotMoreComplexSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotMoreComplexSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt new file mode 100644 index 00000000000..479042d284e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypes.kt @@ -0,0 +1,426 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NotMultipleTypes { + // nest classes so all schemas and input/output classes can be public + + + sealed interface NotBoxed { + fun getData(): Any? + } + + data class NotBoxedNumber(val data: Number) : NotBoxed { + override fun getData(): Any? { + return data + } + } + + data class NotBoxedBoolean(val data: Boolean): NotBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Not private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java, + Boolean::class.java + )) + .format("int") + ), NumberSchemaValidator, BooleanSchemaValidator { + + companion object { + @Volatile + private var instance: Not? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Not().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotBoxedNumber { + return NotBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotBoxedBoolean { + return NotBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotBoxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface NotMultipleTypes1Boxed { + fun getData(): Any? + } + + data class NotMultipleTypes1BoxedVoid(val data: Nothing?) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedBoolean(val data: Boolean): NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedNumber(val data: Number) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedString(val data: String) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedList(val data: FrozenList) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class NotMultipleTypes1BoxedMap(val data: FrozenMap) : NotMultipleTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class NotMultipleTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .not(Not::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, NotMultipleTypes1BoxedList>, MapSchemaValidator, NotMultipleTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NotMultipleTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NotMultipleTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedVoid { + return NotMultipleTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedBoolean { + return NotMultipleTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedNumber { + return NotMultipleTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedString { + return NotMultipleTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedList { + return NotMultipleTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): NotMultipleTypes1BoxedMap { + return NotMultipleTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotMultipleTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt new file mode 100644 index 00000000000..4117850d7fd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStrings.kt @@ -0,0 +1,104 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringEnumValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringValueMethod +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class NulCharactersInStrings { + // nest classes so all schemas and input/output classes can be public + + enum class StringNulCharactersInStringsEnums(private val value: String): StringValueMethod { + HELLO_NULL_THERE("hello\u0000there"); + + override fun value(): String { + return this.value + } + } + + + sealed interface NulCharactersInStrings1Boxed { + fun getData(): Any? + } + + data class NulCharactersInStrings1BoxedString(val data: String) : NulCharactersInStrings1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class NulCharactersInStrings1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .enumValues(setOf( + "hello\u0000there" + )) + ), StringSchemaValidator, StringEnumValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: NulCharactersInStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NulCharactersInStrings1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: StringNulCharactersInStringsEnums, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): NulCharactersInStrings1BoxedString { + return NulCharactersInStrings1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NulCharactersInStrings1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt new file mode 100644 index 00000000000..d4dfe771cb3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObject.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NullJsonSchema + +class NullTypeMatchesOnlyTheNullObject: NullJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NullTypeMatchesOnlyTheNullObject1 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: NullTypeMatchesOnlyTheNullObject1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullTypeMatchesOnlyTheNullObject1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt new file mode 100644 index 00000000000..6cd4a213c71 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbers.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.NumberJsonSchema + +class NumberTypeMatchesNumbers: NumberJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class NumberTypeMatchesNumbers1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: NumberTypeMatchesNumbers1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberTypeMatchesNumbers1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt new file mode 100644 index 00000000000..9eaf12687f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidation.kt @@ -0,0 +1,453 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ObjectPropertiesValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class ObjectPropertiesValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ObjectPropertiesValidationMap { + return ObjectPropertiesValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Number { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): String { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class ObjectPropertiesValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ObjectPropertiesValidationMapBuilder { + return this + } + } + + + sealed interface ObjectPropertiesValidation1Boxed { + fun getData(): Any? + } + + data class ObjectPropertiesValidation1BoxedVoid(val data: Nothing?) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedBoolean(val data: Boolean): ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedNumber(val data: Number) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedString(val data: String) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedList(val data: FrozenList) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ObjectPropertiesValidation1BoxedMap(val data: ObjectPropertiesValidationMap) : ObjectPropertiesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ObjectPropertiesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ObjectPropertiesValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ObjectPropertiesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectPropertiesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ObjectPropertiesValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ObjectPropertiesValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedVoid { + return ObjectPropertiesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedBoolean { + return ObjectPropertiesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedNumber { + return ObjectPropertiesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedString { + return ObjectPropertiesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedList { + return ObjectPropertiesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectPropertiesValidation1BoxedMap { + return ObjectPropertiesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectPropertiesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt new file mode 100644 index 00000000000..0cb08cb0b8f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjects.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +class ObjectTypeMatchesObjects: MapJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class ObjectTypeMatchesObjects1 : MapJsonSchema.MapJsonSchema1() { + companion object { + @Volatile + private var instance: ObjectTypeMatchesObjects1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectTypeMatchesObjects1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt new file mode 100644 index 00000000000..a3ca5e860ba --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/Oneof.kt @@ -0,0 +1,600 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class Oneof { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Oneof1Boxed { + fun getData(): Any? + } + + data class Oneof1BoxedVoid(val data: Nothing?) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedBoolean(val data: Boolean): Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedNumber(val data: Number) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedString(val data: String) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedList(val data: FrozenList) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Oneof1BoxedMap(val data: FrozenMap) : Oneof1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Oneof1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Oneof1BoxedList>, MapSchemaValidator, Oneof1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: Oneof1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Oneof1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Oneof1BoxedVoid { + return Oneof1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Oneof1BoxedBoolean { + return Oneof1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Oneof1BoxedNumber { + return Oneof1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Oneof1BoxedString { + return Oneof1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Oneof1BoxedList { + return Oneof1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Oneof1BoxedMap { + return Oneof1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Oneof1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt new file mode 100644 index 00000000000..0810d902fbb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypes.kt @@ -0,0 +1,1060 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofComplexTypes { + // nest classes so all schemas and input/output classes can be public + + + class Bar : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Number { + val value: Any? = get("bar") + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class Schema0Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map0Builder { + return this + } + } + + class Schema0MapBuilder: SetterForBar { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map0Builder { + return Schema0Map0Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "bar" to Bar::class.java + )) + .required(setOf( + "bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun foo(): String { + val value: Any? = get("foo") + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema1Map0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map0Builder { + return this + } + } + + class Schema1MapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema1Map0Builder { + return Schema1Map0Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofComplexTypes1Boxed { + fun getData(): Any? + } + + data class OneofComplexTypes1BoxedVoid(val data: Nothing?) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedBoolean(val data: Boolean): OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedNumber(val data: Number) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedString(val data: String) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedList(val data: FrozenList) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofComplexTypes1BoxedMap(val data: FrozenMap) : OneofComplexTypes1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofComplexTypes1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofComplexTypes1BoxedList>, MapSchemaValidator, OneofComplexTypes1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofComplexTypes1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofComplexTypes1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedVoid { + return OneofComplexTypes1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedBoolean { + return OneofComplexTypes1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedNumber { + return OneofComplexTypes1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedString { + return OneofComplexTypes1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedList { + return OneofComplexTypes1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofComplexTypes1BoxedMap { + return OneofComplexTypes1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofComplexTypes1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt new file mode 100644 index 00000000000..d82112c6547 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchema.kt @@ -0,0 +1,653 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithBaseSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .minLength(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .maxLength(4) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithBaseSchema1Boxed { + fun getData(): Any? + } + + data class OneofWithBaseSchema1BoxedString(val data: String) : OneofWithBaseSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class OneofWithBaseSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), StringSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithBaseSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithBaseSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithBaseSchema1BoxedString { + return OneofWithBaseSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithBaseSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt new file mode 100644 index 00000000000..06241abdcdd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchema.kt @@ -0,0 +1,339 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithEmptySchema { + // nest classes so all schemas and input/output classes can be public + + + class Schema0 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface OneofWithEmptySchema1Boxed { + fun getData(): Any? + } + + data class OneofWithEmptySchema1BoxedVoid(val data: Nothing?) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedBoolean(val data: Boolean): OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedNumber(val data: Number) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedString(val data: String) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedList(val data: FrozenList) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class OneofWithEmptySchema1BoxedMap(val data: FrozenMap) : OneofWithEmptySchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithEmptySchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, OneofWithEmptySchema1BoxedList>, MapSchemaValidator, OneofWithEmptySchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithEmptySchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithEmptySchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedVoid { + return OneofWithEmptySchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedBoolean { + return OneofWithEmptySchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedNumber { + return OneofWithEmptySchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedString { + return OneofWithEmptySchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedList { + return OneofWithEmptySchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithEmptySchema1BoxedMap { + return OneofWithEmptySchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithEmptySchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt new file mode 100644 index 00000000000..163cebccec9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequired.kt @@ -0,0 +1,1096 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class OneofWithRequired { + // nest classes so all schemas and input/output classes can be public + + + class Schema0Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "bar", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema0Map { + return Schema0.getInstance().validate(arg, configuration) + } + } + + fun bar(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class Schema0Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "bar", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema0Map00Builder { + return this + } + } + + class Schema0Map01Builder(private val instance: MutableMap): SetterForFoo { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0Map10Builder(private val instance: MutableMap): SetterForBar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map00Builder { + return Schema0Map00Builder(instance) + } + } + + class Schema0MapBuilder: SetterForBar, SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): Schema0Map01Builder { + return Schema0Map01Builder(instance) + } + override fun getBuilderAfterFoo(instance: MutableMap): Schema0Map10Builder { + return Schema0Map10Builder(instance) + } + } + + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: Schema0Map) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "bar", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema0Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema0Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Schema1Map(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "baz", + "foo" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): Schema1Map { + return Schema1.getInstance().validate(arg, configuration) + } + } + + fun baz(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForBaz { + fun getInstance(): MutableMap + fun getBuilderAfterBaz(instance: MutableMap): T + + fun baz(value: Nothing?): T { + val instance = getInstance() + instance["baz"] = null + return getBuilderAfterBaz(instance) + } + + fun baz(value: Boolean): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: String): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Int): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Float): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Long): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Double): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: List): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + + fun baz(value: Map): T { + val instance = getInstance() + instance["baz"] = value + return getBuilderAfterBaz(instance) + } + } + + interface SetterForFoo1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoo1(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo1(instance) + } + } + + class Schema1Map00Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "baz", + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): Schema1Map00Builder { + return this + } + } + + class Schema1Map01Builder(private val instance: MutableMap): SetterForFoo1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1Map10Builder(private val instance: MutableMap): SetterForBaz { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map00Builder { + return Schema1Map00Builder(instance) + } + } + + class Schema1MapBuilder: SetterForBaz, SetterForFoo1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBaz(instance: MutableMap): Schema1Map01Builder { + return Schema1Map01Builder(instance) + } + override fun getBuilderAfterFoo1(instance: MutableMap): Schema1Map10Builder { + return Schema1Map10Builder(instance) + } + } + + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: Schema1Map) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "baz", + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): Schema1Map { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return Schema1Map(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1Map { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface OneofWithRequired1Boxed { + fun getData(): Any? + } + + data class OneofWithRequired1BoxedMap(val data: FrozenMap) : OneofWithRequired1Boxed { + override fun getData(): Any? { + return data + } + } + + + class OneofWithRequired1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .oneOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), MapSchemaValidator, OneofWithRequired1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: OneofWithRequired1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: OneofWithRequired1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): OneofWithRequired1BoxedMap { + return OneofWithRequired1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): OneofWithRequired1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt new file mode 100644 index 00000000000..187e8f7823f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchored.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternIsNotAnchored { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternIsNotAnchored1Boxed { + fun getData(): Any? + } + + data class PatternIsNotAnchored1BoxedVoid(val data: Nothing?) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedBoolean(val data: Boolean): PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedNumber(val data: Number) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedString(val data: String) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedList(val data: FrozenList) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternIsNotAnchored1BoxedMap(val data: FrozenMap) : PatternIsNotAnchored1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternIsNotAnchored1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "a+" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternIsNotAnchored1BoxedList>, MapSchemaValidator, PatternIsNotAnchored1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternIsNotAnchored1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternIsNotAnchored1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedVoid { + return PatternIsNotAnchored1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedBoolean { + return PatternIsNotAnchored1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedNumber { + return PatternIsNotAnchored1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedString { + return PatternIsNotAnchored1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedList { + return PatternIsNotAnchored1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternIsNotAnchored1BoxedMap { + return PatternIsNotAnchored1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternIsNotAnchored1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt new file mode 100644 index 00000000000..3d58fd45c4a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidation.kt @@ -0,0 +1,311 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PatternValidation1Boxed { + fun getData(): Any? + } + + data class PatternValidation1BoxedVoid(val data: Nothing?) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedBoolean(val data: Boolean): PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedNumber(val data: Number) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedString(val data: String) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedList(val data: FrozenList) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternValidation1BoxedMap(val data: FrozenMap) : PatternValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .pattern(Pattern.compile( + "^a*\$" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternValidation1BoxedList>, MapSchemaValidator, PatternValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternValidation1BoxedVoid { + return PatternValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternValidation1BoxedBoolean { + return PatternValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternValidation1BoxedNumber { + return PatternValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternValidation1BoxedString { + return PatternValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternValidation1BoxedList { + return PatternValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternValidation1BoxedMap { + return PatternValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt new file mode 100644 index 00000000000..b845f06085f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegex.kt @@ -0,0 +1,326 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternpropertiesValidatesPropertiesMatchingARegex { + // nest classes so all schemas and input/output classes can be public + + + class Fo : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Fo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Fo().also { instance = it } + } + } + } + + + sealed interface PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + fun getData(): Any? + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid(val data: Nothing?) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean(val data: Boolean): PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber(val data: Number) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString(val data: String) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList(val data: FrozenList) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap(val data: FrozenMap) : PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternpropertiesValidatesPropertiesMatchingARegex1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + Pattern.compile("f.*o") to Fo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList>, MapSchemaValidator, PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternpropertiesValidatesPropertiesMatchingARegex1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternpropertiesValidatesPropertiesMatchingARegex1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap { + return PatternpropertiesValidatesPropertiesMatchingARegex1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternpropertiesValidatesPropertiesMatchingARegex1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..630c4c1adec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,326 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PatternpropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class Bar : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + sealed interface PatternpropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid(val data: Nothing?) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean(val data: Boolean): PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber(val data: Number) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedString(val data: String) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedList(val data: FrozenList) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PatternpropertiesWithNullValuedInstanceProperties1BoxedMap(val data: FrozenMap) : PatternpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PatternpropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + Pattern.compile("^.*bar\$") to Bar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PatternpropertiesWithNullValuedInstanceProperties1BoxedList>, MapSchemaValidator, PatternpropertiesWithNullValuedInstanceProperties1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PatternpropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PatternpropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedString { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedList { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1BoxedMap { + return PatternpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PatternpropertiesWithNullValuedInstanceProperties1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt new file mode 100644 index 00000000000..1b5398222d4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItems.kt @@ -0,0 +1,187 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PrefixitemsValidationAdjustsTheStartingIndexForItems { + // nest classes so all schemas and input/output classes can be public + + + class Items : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class PrefixitemsValidationAdjustsTheStartingIndexForItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItemsList { + return PrefixitemsValidationAdjustsTheStartingIndexForItems1.getInstance().validate(arg, configuration) + } + } + } + + class PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed { + fun getData(): Any? + } + + data class PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList(val data: PrefixitemsValidationAdjustsTheStartingIndexForItemsList) : PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class PrefixitemsValidationAdjustsTheStartingIndexForItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + .prefixItems(listOf( + Schema0::class.java + )) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PrefixitemsValidationAdjustsTheStartingIndexForItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PrefixitemsValidationAdjustsTheStartingIndexForItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): PrefixitemsValidationAdjustsTheStartingIndexForItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Any)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return PrefixitemsValidationAdjustsTheStartingIndexForItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList { + return PrefixitemsValidationAdjustsTheStartingIndexForItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PrefixitemsValidationAdjustsTheStartingIndexForItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt new file mode 100644 index 00000000000..d2d5dc39042 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElements.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PrefixitemsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class PrefixitemsWithNullInstanceElementsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElementsList { + return PrefixitemsWithNullInstanceElements1.getInstance().validate(arg, configuration) + } + } + } + + class PrefixitemsWithNullInstanceElementsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: String): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): PrefixitemsWithNullInstanceElementsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + sealed interface PrefixitemsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class PrefixitemsWithNullInstanceElements1BoxedVoid(val data: Nothing?) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedBoolean(val data: Boolean): PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedNumber(val data: Number) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedString(val data: String) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedList(val data: PrefixitemsWithNullInstanceElementsList) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PrefixitemsWithNullInstanceElements1BoxedMap(val data: FrozenMap) : PrefixitemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PrefixitemsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .prefixItems(listOf( + Schema0::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, PrefixitemsWithNullInstanceElements1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PrefixitemsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PrefixitemsWithNullInstanceElements1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): PrefixitemsWithNullInstanceElementsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return PrefixitemsWithNullInstanceElementsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElementsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedVoid { + return PrefixitemsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedBoolean { + return PrefixitemsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedNumber { + return PrefixitemsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedString { + return PrefixitemsWithNullInstanceElements1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedList { + return PrefixitemsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1BoxedMap { + return PrefixitemsWithNullInstanceElements1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PrefixitemsWithNullInstanceElements1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt new file mode 100644 index 00000000000..2f42413500b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteraction.kt @@ -0,0 +1,651 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.ListJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesPatternpropertiesAdditionalpropertiesInteraction { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : IntJsonSchema.IntJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + sealed interface FoBoxed { + fun getData(): Any? + } + + data class FoBoxedVoid(val data: Nothing?) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedBoolean(val data: Boolean): FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedNumber(val data: Number) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedString(val data: String) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedList(val data: FrozenList) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + data class FoBoxedMap(val data: FrozenMap) : FoBoxed { + override fun getData(): Any? { + return data + } + } + + + class Fo private constructor(): JsonSchema( + JsonSchemaInfo() + .minItems(2) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, FoBoxedList>, MapSchemaValidator, FoBoxedMap> { + + companion object { + @Volatile + private var instance: Fo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Fo().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): FoBoxedVoid { + return FoBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): FoBoxedBoolean { + return FoBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FoBoxedNumber { + return FoBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): FoBoxedString { + return FoBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FoBoxedList { + return FoBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): FoBoxedMap { + return FoBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FoBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface FooBoxed { + fun getData(): Any? + } + + data class FooBoxedList(val data: FrozenList) : FooBoxed { + override fun getData(): Any? { + return data + } + } + + + + class Foo private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .maxItems(3) + ), ListSchemaValidator, FooBoxedList> { + + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): FooBoxedList { + return FooBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FooBoxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class Bar : ListJsonSchema.ListJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo", + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { + return PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): FrozenList<*> { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is FrozenList<*>)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class) + fun bar(): FrozenList<*> { + val key = "bar" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is FrozenList<*>)) { + throw RuntimeException("Invalid value stored for bar") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Number { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + val value = getOrThrow(name) + if (!(value is Number)) { + throw RuntimeException("Invalid value stored for " + name) + } + return value + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder: GenericBuilder>, SetterForFoo, SetterForBar, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + return this + } + override fun getBuilderAfterBar(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMapBuilder { + return this + } + } + + + sealed interface PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed { + fun getData(): Any? + } + + data class PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap(val data: PropertiesPatternpropertiesAdditionalpropertiesInteractionMap) : PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesPatternpropertiesAdditionalpropertiesInteraction1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + .patternProperties(mapOf( + Pattern.compile("f.o") to Fo::class.java + )) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesPatternpropertiesAdditionalpropertiesInteraction1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesPatternpropertiesAdditionalpropertiesInteraction1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesPatternpropertiesAdditionalpropertiesInteractionMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesPatternpropertiesAdditionalpropertiesInteractionMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap { + return PropertiesPatternpropertiesAdditionalpropertiesInteraction1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesPatternpropertiesAdditionalpropertiesInteraction1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt new file mode 100644 index 00000000000..8151f89805d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt @@ -0,0 +1,872 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWhoseNamesAreJavascriptObjectPropertyNames { + // nest classes so all schemas and input/output classes can be public + + + class Proto : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Proto? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Proto().also { instance = it } + } + } + } + + + class Length : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Length? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Length().also { instance = it } + } + } + } + + + class ToStringMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "length" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): ToStringMap { + return ToStringSchema.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun length(): String { + val key = "length" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for length") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForLength { + fun getInstance(): MutableMap + fun getBuilderAfterLength(instance: MutableMap): T + + fun length(value: String): T { + val instance = getInstance() + instance["length"] = value + return getBuilderAfterLength(instance) + } + } + + class ToStringMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForLength { + private val knownKeys: Set = setOf( + "length" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterLength(instance: MutableMap): ToStringMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): ToStringMapBuilder { + return this + } + } + + + sealed interface ToStringSchemaBoxed { + fun getData(): Any? + } + + data class ToStringSchemaBoxedVoid(val data: Nothing?) : ToStringSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringSchemaBoxedBoolean(val data: Boolean): ToStringSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringSchemaBoxedNumber(val data: Number) : ToStringSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringSchemaBoxedString(val data: String) : ToStringSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringSchemaBoxedList(val data: FrozenList) : ToStringSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ToStringSchemaBoxedMap(val data: ToStringMap) : ToStringSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ToStringSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "length" to Length::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ToStringSchemaBoxedList>, MapSchemaValidator { + + companion object { + @Volatile + private var instance: ToStringSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ToStringSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): ToStringMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return ToStringMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ToStringMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ToStringSchemaBoxedVoid { + return ToStringSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ToStringSchemaBoxedBoolean { + return ToStringSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ToStringSchemaBoxedNumber { + return ToStringSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ToStringSchemaBoxedString { + return ToStringSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ToStringSchemaBoxedList { + return ToStringSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ToStringSchemaBoxedMap { + return ToStringSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ToStringSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class ConstructorSchema : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: ConstructorSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ConstructorSchema().also { instance = it } + } + } + } + + + class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "__proto__", + "toString", + "constructor" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForProto { + fun getInstance(): MutableMap + fun getBuilderAfterProto(instance: MutableMap): T + + fun lowLineProto(value: Int): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Float): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Long): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Double): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + } + + interface SetterForToStringSchema { + fun getInstance(): MutableMap + fun getBuilderAfterToStringSchema(instance: MutableMap): T + + fun toString(value: Nothing?): T { + val instance = getInstance() + instance["toString"] = null + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Boolean): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: String): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Int): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Float): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Long): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Double): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: List): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Map): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + } + + interface SetterForConstructorSchema { + fun getInstance(): MutableMap + fun getBuilderAfterConstructorSchema(instance: MutableMap): T + + fun setConstructor(value: Int): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Float): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Long): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Double): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + } + + class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForProto, SetterForToStringSchema, SetterForConstructorSchema { + private val knownKeys: Set = setOf( + "__proto__", + "toString", + "constructor" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + override fun getBuilderAfterToStringSchema(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder { + return this + } + } + + + sealed interface PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + fun getData(): Any? + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(val data: Nothing?) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(val data: Boolean): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(val data: Number) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(val data: String) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(val data: FrozenList) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(val data: PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap) : PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWhoseNamesAreJavascriptObjectPropertyNames1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "__proto__" to Proto::class.java, + "toString" to ToStringSchema::class.java, + "constructor" to ConstructorSchema::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWhoseNamesAreJavascriptObjectPropertyNames1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWhoseNamesAreJavascriptObjectPropertyNames1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap { + return PropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt new file mode 100644 index 00000000000..14863b15c8a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharacters.kt @@ -0,0 +1,640 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class Foonbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foonbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foonbar().also { instance = it } + } + } + } + + + class Foobar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar().also { instance = it } + } + } + } + + + class Foobar1 : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foobar1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foobar1().also { instance = it } + } + } + } + + + class Foorbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foorbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foorbar().also { instance = it } + } + } + } + + + class Footbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Footbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Footbar().also { instance = it } + } + } + } + + + class Foou000Cbar : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Foou000Cbar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foou000Cbar().also { instance = it } + } + } + } + + + class PropertiesWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWithEscapedCharactersMap { + return PropertiesWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + class PropertiesWithEscapedCharactersMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoonbar, SetterForFoobar, SetterForFoobar1, SetterForFoorbar, SetterForFootbar, SetterForFoou000Cbar { + private val knownKeys: Set = setOf( + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\u000Cbar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoobar1(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoorbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFootbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWithEscapedCharactersMapBuilder { + return this + } + } + + + sealed interface PropertiesWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class PropertiesWithEscapedCharacters1BoxedVoid(val data: Nothing?) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedBoolean(val data: Boolean): PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedNumber(val data: Number) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedString(val data: String) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedList(val data: FrozenList) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithEscapedCharacters1BoxedMap(val data: PropertiesWithEscapedCharactersMap) : PropertiesWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo\nbar" to Foonbar::class.java, + "foo\"bar" to Foobar::class.java, + "foo\\bar" to Foobar1::class.java, + "foo\rbar" to Foorbar::class.java, + "foo\tbar" to Footbar::class.java, + "foo\u000Cbar" to Foou000Cbar::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedVoid { + return PropertiesWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedBoolean { + return PropertiesWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedNumber { + return PropertiesWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedString { + return PropertiesWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedList { + return PropertiesWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1BoxedMap { + return PropertiesWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..7b48f5b0378 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,393 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class Foo : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class PropertiesWithNullValuedInstancePropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertiesWithNullValuedInstancePropertiesMap { + return PropertiesWithNullValuedInstanceProperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Nothing? { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value == null || value is Nothing?)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + } + + class PropertiesWithNullValuedInstancePropertiesMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): PropertiesWithNullValuedInstancePropertiesMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertiesWithNullValuedInstancePropertiesMapBuilder { + return this + } + } + + + sealed interface PropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedVoid(val data: Nothing?) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedBoolean(val data: Boolean): PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedNumber(val data: Number) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedString(val data: String) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedList(val data: FrozenList) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertiesWithNullValuedInstanceProperties1BoxedMap(val data: PropertiesWithNullValuedInstancePropertiesMap) : PropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertiesWithNullValuedInstanceProperties1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertiesWithNullValuedInstancePropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertiesWithNullValuedInstancePropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstancePropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedVoid { + return PropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedBoolean { + return PropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedNumber { + return PropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedString { + return PropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedList { + return PropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1BoxedMap { + return PropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertiesWithNullValuedInstanceProperties1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt new file mode 100644 index 00000000000..7517a23585e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReference.kt @@ -0,0 +1,382 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertyNamedRefThatIsNotAReference { + // nest classes so all schemas and input/output classes can be public + + + class Ref : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Ref? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Ref().also { instance = it } + } + } + } + + + class PropertyNamedRefThatIsNotAReferenceMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "\$ref" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): PropertyNamedRefThatIsNotAReferenceMap { + return PropertyNamedRefThatIsNotAReference1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForRef { + fun getInstance(): MutableMap + fun getBuilderAfterRef(instance: MutableMap): T + + fun reverseSolidusDollarSignRef(value: String): T { + val instance = getInstance() + instance["\$ref"] = value + return getBuilderAfterRef(instance) + } + } + + class PropertyNamedRefThatIsNotAReferenceMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForRef { + private val knownKeys: Set = setOf( + "\$ref" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterRef(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): PropertyNamedRefThatIsNotAReferenceMapBuilder { + return this + } + } + + + sealed interface PropertyNamedRefThatIsNotAReference1Boxed { + fun getData(): Any? + } + + data class PropertyNamedRefThatIsNotAReference1BoxedVoid(val data: Nothing?) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedBoolean(val data: Boolean): PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedNumber(val data: Number) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedString(val data: String) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedList(val data: FrozenList) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertyNamedRefThatIsNotAReference1BoxedMap(val data: PropertyNamedRefThatIsNotAReferenceMap) : PropertyNamedRefThatIsNotAReference1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertyNamedRefThatIsNotAReference1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "\$ref" to Ref::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertyNamedRefThatIsNotAReference1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertyNamedRefThatIsNotAReference1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNamedRefThatIsNotAReference1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): PropertyNamedRefThatIsNotAReferenceMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return PropertyNamedRefThatIsNotAReferenceMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReferenceMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedVoid { + return PropertyNamedRefThatIsNotAReference1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedBoolean { + return PropertyNamedRefThatIsNotAReference1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedNumber { + return PropertyNamedRefThatIsNotAReference1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedString { + return PropertyNamedRefThatIsNotAReference1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedList { + return PropertyNamedRefThatIsNotAReference1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1BoxedMap { + return PropertyNamedRefThatIsNotAReference1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamedRefThatIsNotAReference1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt new file mode 100644 index 00000000000..acdf4bc0e3a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidation.kt @@ -0,0 +1,375 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class PropertynamesValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PropertyNamesBoxed { + fun getData(): Any? + } + + data class PropertyNamesBoxedString(val data: String) : PropertyNamesBoxed { + override fun getData(): Any? { + return data + } + } + + + + class PropertyNames private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .maxLength(3) + ), StringSchemaValidator { + + companion object { + @Volatile + private var instance: PropertyNames? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNames().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamesBoxedString { + return PropertyNamesBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamesBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface PropertynamesValidation1Boxed { + fun getData(): Any? + } + + data class PropertynamesValidation1BoxedVoid(val data: Nothing?) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedBoolean(val data: Boolean): PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedNumber(val data: Number) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedString(val data: String) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedList(val data: FrozenList) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class PropertynamesValidation1BoxedMap(val data: FrozenMap) : PropertynamesValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class PropertynamesValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .propertyNames(PropertyNames::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, PropertynamesValidation1BoxedList>, MapSchemaValidator, PropertynamesValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: PropertynamesValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertynamesValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedVoid { + return PropertynamesValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedBoolean { + return PropertynamesValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedNumber { + return PropertynamesValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedString { + return PropertynamesValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedList { + return PropertynamesValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): PropertynamesValidation1BoxedMap { + return PropertynamesValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertynamesValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt new file mode 100644 index 00000000000..d0690c620f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RegexFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RegexFormat1Boxed { + fun getData(): Any? + } + + data class RegexFormat1BoxedVoid(val data: Nothing?) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedBoolean(val data: Boolean): RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedNumber(val data: Number) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedString(val data: String) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedList(val data: FrozenList) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexFormat1BoxedMap(val data: FrozenMap) : RegexFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RegexFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("regex") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RegexFormat1BoxedList>, MapSchemaValidator, RegexFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RegexFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RegexFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RegexFormat1BoxedVoid { + return RegexFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RegexFormat1BoxedBoolean { + return RegexFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RegexFormat1BoxedNumber { + return RegexFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RegexFormat1BoxedString { + return RegexFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RegexFormat1BoxedList { + return RegexFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RegexFormat1BoxedMap { + return RegexFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RegexFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt new file mode 100644 index 00000000000..2bd7e34db0c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.kt @@ -0,0 +1,341 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import java.util.regex.Pattern +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive { + // nest classes so all schemas and input/output classes can be public + + + class Schema092 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema092? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema092().also { instance = it } + } + } + } + + + class X : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: X? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: X().also { instance = it } + } + } + } + + + sealed interface RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + fun getData(): Any? + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid(val data: Nothing?) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean(val data: Boolean): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber(val data: Number) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString(val data: String) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList(val data: FrozenList) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap(val data: FrozenMap) : RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1 private constructor(): JsonSchema( + JsonSchemaInfo() + .patternProperties(mapOf( + Pattern.compile("[0-9]{2,}") to Schema092::class.java, + Pattern.compile("X_") to X::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList>, MapSchemaValidator, RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap { + return RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt new file mode 100644 index 00000000000..6d7e164409f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RelativeJsonPointerFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface RelativeJsonPointerFormat1Boxed { + fun getData(): Any? + } + + data class RelativeJsonPointerFormat1BoxedVoid(val data: Nothing?) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedBoolean(val data: Boolean): RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedNumber(val data: Number) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedString(val data: String) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedList(val data: FrozenList) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RelativeJsonPointerFormat1BoxedMap(val data: FrozenMap) : RelativeJsonPointerFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RelativeJsonPointerFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("relative-json-pointer") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RelativeJsonPointerFormat1BoxedList>, MapSchemaValidator, RelativeJsonPointerFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RelativeJsonPointerFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RelativeJsonPointerFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedVoid { + return RelativeJsonPointerFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedBoolean { + return RelativeJsonPointerFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedNumber { + return RelativeJsonPointerFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedString { + return RelativeJsonPointerFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedList { + return RelativeJsonPointerFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1BoxedMap { + return RelativeJsonPointerFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RelativeJsonPointerFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt new file mode 100644 index 00000000000..5774da81ccc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidation.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredDefaultValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredDefaultValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredDefaultValidationMap { + return RequiredDefaultValidation1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredDefaultValidationMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredDefaultValidationMapBuilder { + return this + } + } + + + sealed interface RequiredDefaultValidation1Boxed { + fun getData(): Any? + } + + data class RequiredDefaultValidation1BoxedVoid(val data: Nothing?) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedBoolean(val data: Boolean): RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedNumber(val data: Number) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedString(val data: String) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedList(val data: FrozenList) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredDefaultValidation1BoxedMap(val data: RequiredDefaultValidationMap) : RequiredDefaultValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredDefaultValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredDefaultValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredDefaultValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredDefaultValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredDefaultValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredDefaultValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedVoid { + return RequiredDefaultValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedBoolean { + return RequiredDefaultValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedNumber { + return RequiredDefaultValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedString { + return RequiredDefaultValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedList { + return RequiredDefaultValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredDefaultValidation1BoxedMap { + return RequiredDefaultValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredDefaultValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt new file mode 100644 index 00000000000..e5207da569b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.kt @@ -0,0 +1,615 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames { + // nest classes so all schemas and input/output classes can be public + + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "__proto__", + "constructor", + "toString" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForProto { + fun getInstance(): MutableMap + fun getBuilderAfterProto(instance: MutableMap): T + + fun lowLineProto(value: Nothing?): T { + val instance = getInstance() + instance["__proto__"] = null + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Boolean): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: String): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Int): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Float): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Long): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Double): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: List): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + + fun lowLineProto(value: Map): T { + val instance = getInstance() + instance["__proto__"] = value + return getBuilderAfterProto(instance) + } + } + + interface SetterForConstructorSchema { + fun getInstance(): MutableMap + fun getBuilderAfterConstructorSchema(instance: MutableMap): T + + fun setConstructor(value: Nothing?): T { + val instance = getInstance() + instance["constructor"] = null + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Boolean): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: String): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Int): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Float): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Long): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Double): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: List): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + + fun setConstructor(value: Map): T { + val instance = getInstance() + instance["constructor"] = value + return getBuilderAfterConstructorSchema(instance) + } + } + + interface SetterForToStringSchema { + fun getInstance(): MutableMap + fun getBuilderAfterToStringSchema(instance: MutableMap): T + + fun toString(value: Nothing?): T { + val instance = getInstance() + instance["toString"] = null + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Boolean): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: String): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Int): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Float): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Long): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Double): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: List): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + + fun toString(value: Map): T { + val instance = getInstance() + instance["toString"] = value + return getBuilderAfterToStringSchema(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "__proto__", + "constructor", + "toString" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return this + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(private val instance: MutableMap): SetterForToStringSchema { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(private val instance: MutableMap): SetterForConstructorSchema { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(private val instance: MutableMap): SetterForConstructorSchema, SetterForToStringSchema { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(instance) + } + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(private val instance: MutableMap): SetterForProto { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap000Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(private val instance: MutableMap): SetterForProto, SetterForToStringSchema { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap001Builder(instance) + } + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder(private val instance: MutableMap): SetterForProto, SetterForConstructorSchema { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap010Builder(instance) + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap100Builder(instance) + } + } + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMapBuilder: SetterForProto, SetterForConstructorSchema, SetterForToStringSchema { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterProto(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap011Builder(instance) + } + override fun getBuilderAfterConstructorSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap101Builder(instance) + } + override fun getBuilderAfterToStringSchema(instance: MutableMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap110Builder(instance) + } + } + + + sealed interface RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + fun getData(): Any? + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(val data: Nothing?) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(val data: Boolean): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(val data: Number) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(val data: String) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(val data: FrozenList) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(val data: RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap) : RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "__proto__", + "constructor", + "toString" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap { + return RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt new file mode 100644 index 00000000000..1ff4bb0d707 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidation.kt @@ -0,0 +1,531 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredValidation { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class Bar : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Bar? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Bar().also { instance = it } + } + } + } + + + class RequiredValidationMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo" + ) + val optionalKeys: Set = setOf( + "bar" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredValidationMap { + return RequiredValidation1.getInstance().validate(arg, configuration) + } + } + + fun foo(): Any? { + try { + return getOrThrow("version") + } catch (e: UnsetPropertyException) { + throw RuntimeException(e) + } + } + + @Throws(UnsetPropertyException::class) + fun bar(): Any? { + return getOrThrow("bar") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForBar { + fun getInstance(): MutableMap + fun getBuilderAfterBar(instance: MutableMap): T + + fun bar(value: Nothing?): T { + val instance = getInstance() + instance["bar"] = null + return getBuilderAfterBar(instance) + } + + fun bar(value: Boolean): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: String): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Int): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Float): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Long): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Double): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: List): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + + fun bar(value: Map): T { + val instance = getInstance() + instance["bar"] = value + return getBuilderAfterBar(instance) + } + } + + class RequiredValidationMap0Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder>, SetterForBar { + private val knownKeys: Set = setOf( + "foo", + "bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterBar(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredValidationMap0Builder { + return this + } + } + + class RequiredValidationMapBuilder: SetterForFoo { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredValidationMap0Builder { + return RequiredValidationMap0Builder(instance) + } + } + + + sealed interface RequiredValidation1Boxed { + fun getData(): Any? + } + + data class RequiredValidation1BoxedVoid(val data: Nothing?) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedBoolean(val data: Boolean): RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedNumber(val data: Number) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedString(val data: String) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedList(val data: FrozenList) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredValidation1BoxedMap(val data: RequiredValidationMap) : RequiredValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java, + "bar" to Bar::class.java + )) + .required(setOf( + "foo" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredValidation1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredValidationMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredValidationMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidationMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredValidation1BoxedVoid { + return RequiredValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredValidation1BoxedBoolean { + return RequiredValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredValidation1BoxedNumber { + return RequiredValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredValidation1BoxedString { + return RequiredValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredValidation1BoxedList { + return RequiredValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredValidation1BoxedMap { + return RequiredValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt new file mode 100644 index 00000000000..d8eaca1b1e1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArray.kt @@ -0,0 +1,435 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEmptyArray { + // nest classes so all schemas and input/output classes can be public + + + class Foo : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class RequiredWithEmptyArrayMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEmptyArrayMap { + return RequiredWithEmptyArray1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): Any? { + return getOrThrow("foo") + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: Nothing?): T { + val instance = getInstance() + instance["foo"] = null + return getBuilderAfterFoo(instance) + } + + fun foo(value: Boolean): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Int): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Float): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Long): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Double): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: List): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + + fun foo(value: Map): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + class RequiredWithEmptyArrayMapBuilder: UnsetAddPropsSetter, GenericBuilder>, SetterForFoo { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEmptyArrayMapBuilder { + return this + } + } + + + sealed interface RequiredWithEmptyArray1Boxed { + fun getData(): Any? + } + + data class RequiredWithEmptyArray1BoxedVoid(val data: Nothing?) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedBoolean(val data: Boolean): RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedNumber(val data: Number) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedString(val data: String) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedList(val data: FrozenList) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEmptyArray1BoxedMap(val data: RequiredWithEmptyArrayMap) : RequiredWithEmptyArray1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEmptyArray1 private constructor(): JsonSchema( + JsonSchemaInfo() + .properties(mapOf( + "foo" to Foo::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEmptyArray1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEmptyArray1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEmptyArray1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEmptyArrayMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEmptyArrayMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArrayMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedVoid { + return RequiredWithEmptyArray1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedBoolean { + return RequiredWithEmptyArray1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedNumber { + return RequiredWithEmptyArray1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedString { + return RequiredWithEmptyArray1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedList { + return RequiredWithEmptyArray1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEmptyArray1BoxedMap { + return RequiredWithEmptyArray1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEmptyArray1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt new file mode 100644 index 00000000000..872c5f93243 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharacters.kt @@ -0,0 +1,1677 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class RequiredWithEscapedCharacters { + // nest classes so all schemas and input/output classes can be public + + + class RequiredWithEscapedCharactersMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + val optionalKeys: Set = setOf() + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): RequiredWithEscapedCharactersMap { + return RequiredWithEscapedCharacters1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + throwIfKeyNotPresent(name) + return get(name) + } + } + + interface SetterForFootbar { + fun getInstance(): MutableMap + fun getBuilderAfterFootbar(instance: MutableMap): T + + fun fooReverseSolidusTbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\tbar"] = null + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Boolean): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: String): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Int): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Float): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Long): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Double): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: List): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + + fun fooReverseSolidusTbar(value: Map): T { + val instance = getInstance() + instance["foo\tbar"] = value + return getBuilderAfterFootbar(instance) + } + } + + interface SetterForFoonbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoonbar(instance: MutableMap): T + + fun fooReverseSolidusNbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\nbar"] = null + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Boolean): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: String): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Int): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Float): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Long): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Double): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: List): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + + fun fooReverseSolidusNbar(value: Map): T { + val instance = getInstance() + instance["foo\nbar"] = value + return getBuilderAfterFoonbar(instance) + } + } + + interface SetterForFoou000Cbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoou000Cbar(instance: MutableMap): T + + fun fooReverseSolidusU000cbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\u000Cbar"] = null + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Boolean): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: String): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Int): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Float): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Long): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Double): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: List): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + + fun fooReverseSolidusU000cbar(value: Map): T { + val instance = getInstance() + instance["foo\u000Cbar"] = value + return getBuilderAfterFoou000Cbar(instance) + } + } + + interface SetterForFoorbar { + fun getInstance(): MutableMap + fun getBuilderAfterFoorbar(instance: MutableMap): T + + fun fooReverseSolidusRbar(value: Nothing?): T { + val instance = getInstance() + instance["foo\rbar"] = null + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Boolean): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: String): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Int): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Float): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Long): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Double): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: List): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + + fun fooReverseSolidusRbar(value: Map): T { + val instance = getInstance() + instance["foo\rbar"] = value + return getBuilderAfterFoorbar(instance) + } + } + + interface SetterForFoobar { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar(instance: MutableMap): T + + fun fooReverseSolidusQuotationMarkBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\"bar"] = null + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Boolean): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: String): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Int): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Float): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Long): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Double): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: List): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + + fun fooReverseSolidusQuotationMarkBar(value: Map): T { + val instance = getInstance() + instance["foo\"bar"] = value + return getBuilderAfterFoobar(instance) + } + } + + interface SetterForFoobar1 { + fun getInstance(): MutableMap + fun getBuilderAfterFoobar1(instance: MutableMap): T + + fun fooReverseSolidusReverseSolidusBar(value: Nothing?): T { + val instance = getInstance() + instance["foo\\bar"] = null + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Boolean): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: String): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Int): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Float): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Long): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Double): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: List): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + + fun fooReverseSolidusReverseSolidusBar(value: Map): T { + val instance = getInstance() + instance["foo\\bar"] = value + return getBuilderAfterFoobar1(instance) + } + } + + class RequiredWithEscapedCharactersMap000000Builder(private val instance: MutableMap): UnsetAddPropsSetter, GenericBuilder> { + private val knownKeys: Set = setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return this + } + } + + class RequiredWithEscapedCharactersMap000001Builder(private val instance: MutableMap): SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000010Builder(private val instance: MutableMap): SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000011Builder(private val instance: MutableMap): SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000100Builder(private val instance: MutableMap): SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000101Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000110Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap000111Builder(private val instance: MutableMap): SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001000Builder(private val instance: MutableMap): SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001001Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001010Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001011Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001100Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001101Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001110Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap001111Builder(private val instance: MutableMap): SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010000Builder(private val instance: MutableMap): SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap010111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011000Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011001Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011010Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011011Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011100Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011101Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011110Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap011111Builder(private val instance: MutableMap): SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100000Builder(private val instance: MutableMap): SetterForFootbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000000Builder { + return RequiredWithEscapedCharactersMap000000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000001Builder { + return RequiredWithEscapedCharactersMap000001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000010Builder { + return RequiredWithEscapedCharactersMap000010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000011Builder { + return RequiredWithEscapedCharactersMap000011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000100Builder { + return RequiredWithEscapedCharactersMap000100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000101Builder { + return RequiredWithEscapedCharactersMap000101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000110Builder { + return RequiredWithEscapedCharactersMap000110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap100111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap000111Builder { + return RequiredWithEscapedCharactersMap000111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001000Builder { + return RequiredWithEscapedCharactersMap001000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001001Builder { + return RequiredWithEscapedCharactersMap001001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001010Builder { + return RequiredWithEscapedCharactersMap001010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001011Builder { + return RequiredWithEscapedCharactersMap001011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001100Builder { + return RequiredWithEscapedCharactersMap001100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001101Builder { + return RequiredWithEscapedCharactersMap001101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001110Builder { + return RequiredWithEscapedCharactersMap001110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap101111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap001111Builder { + return RequiredWithEscapedCharactersMap001111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010000Builder { + return RequiredWithEscapedCharactersMap010000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100000Builder { + return RequiredWithEscapedCharactersMap100000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010001Builder { + return RequiredWithEscapedCharactersMap010001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100001Builder { + return RequiredWithEscapedCharactersMap100001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010010Builder { + return RequiredWithEscapedCharactersMap010010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100010Builder { + return RequiredWithEscapedCharactersMap100010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010011Builder { + return RequiredWithEscapedCharactersMap010011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100011Builder { + return RequiredWithEscapedCharactersMap100011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010100Builder { + return RequiredWithEscapedCharactersMap010100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100100Builder { + return RequiredWithEscapedCharactersMap100100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010101Builder { + return RequiredWithEscapedCharactersMap010101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100101Builder { + return RequiredWithEscapedCharactersMap100101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010110Builder { + return RequiredWithEscapedCharactersMap010110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100110Builder { + return RequiredWithEscapedCharactersMap100110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap110111Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap010111Builder { + return RequiredWithEscapedCharactersMap010111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap100111Builder { + return RequiredWithEscapedCharactersMap100111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111000Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011000Builder { + return RequiredWithEscapedCharactersMap011000Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101000Builder { + return RequiredWithEscapedCharactersMap101000Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110000Builder { + return RequiredWithEscapedCharactersMap110000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111001Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011001Builder { + return RequiredWithEscapedCharactersMap011001Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101001Builder { + return RequiredWithEscapedCharactersMap101001Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110001Builder { + return RequiredWithEscapedCharactersMap110001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111010Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011010Builder { + return RequiredWithEscapedCharactersMap011010Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101010Builder { + return RequiredWithEscapedCharactersMap101010Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110010Builder { + return RequiredWithEscapedCharactersMap110010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111011Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoobar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011011Builder { + return RequiredWithEscapedCharactersMap011011Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101011Builder { + return RequiredWithEscapedCharactersMap101011Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110011Builder { + return RequiredWithEscapedCharactersMap110011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111100Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011100Builder { + return RequiredWithEscapedCharactersMap011100Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101100Builder { + return RequiredWithEscapedCharactersMap101100Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110100Builder { + return RequiredWithEscapedCharactersMap110100Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111000Builder { + return RequiredWithEscapedCharactersMap111000Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111101Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar1 { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011101Builder { + return RequiredWithEscapedCharactersMap011101Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101101Builder { + return RequiredWithEscapedCharactersMap101101Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110101Builder { + return RequiredWithEscapedCharactersMap110101Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111001Builder { + return RequiredWithEscapedCharactersMap111001Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMap111110Builder(private val instance: MutableMap): SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar { + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011110Builder { + return RequiredWithEscapedCharactersMap011110Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101110Builder { + return RequiredWithEscapedCharactersMap101110Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110110Builder { + return RequiredWithEscapedCharactersMap110110Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111010Builder { + return RequiredWithEscapedCharactersMap111010Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111100Builder { + return RequiredWithEscapedCharactersMap111100Builder(instance) + } + } + + class RequiredWithEscapedCharactersMapBuilder: SetterForFootbar, SetterForFoonbar, SetterForFoou000Cbar, SetterForFoorbar, SetterForFoobar, SetterForFoobar1 { + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFootbar(instance: MutableMap): RequiredWithEscapedCharactersMap011111Builder { + return RequiredWithEscapedCharactersMap011111Builder(instance) + } + override fun getBuilderAfterFoonbar(instance: MutableMap): RequiredWithEscapedCharactersMap101111Builder { + return RequiredWithEscapedCharactersMap101111Builder(instance) + } + override fun getBuilderAfterFoou000Cbar(instance: MutableMap): RequiredWithEscapedCharactersMap110111Builder { + return RequiredWithEscapedCharactersMap110111Builder(instance) + } + override fun getBuilderAfterFoorbar(instance: MutableMap): RequiredWithEscapedCharactersMap111011Builder { + return RequiredWithEscapedCharactersMap111011Builder(instance) + } + override fun getBuilderAfterFoobar(instance: MutableMap): RequiredWithEscapedCharactersMap111101Builder { + return RequiredWithEscapedCharactersMap111101Builder(instance) + } + override fun getBuilderAfterFoobar1(instance: MutableMap): RequiredWithEscapedCharactersMap111110Builder { + return RequiredWithEscapedCharactersMap111110Builder(instance) + } + } + + + sealed interface RequiredWithEscapedCharacters1Boxed { + fun getData(): Any? + } + + data class RequiredWithEscapedCharacters1BoxedVoid(val data: Nothing?) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedBoolean(val data: Boolean): RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedNumber(val data: Number) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedString(val data: String) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedList(val data: FrozenList) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + data class RequiredWithEscapedCharacters1BoxedMap(val data: RequiredWithEscapedCharactersMap) : RequiredWithEscapedCharacters1Boxed { + override fun getData(): Any? { + return data + } + } + + + class RequiredWithEscapedCharacters1 private constructor(): JsonSchema( + JsonSchemaInfo() + .required(setOf( + "foo\tbar", + "foo\nbar", + "foo\u000Cbar", + "foo\rbar", + "foo\"bar", + "foo\\bar" + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, RequiredWithEscapedCharacters1BoxedList>, MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: RequiredWithEscapedCharacters1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RequiredWithEscapedCharacters1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): RequiredWithEscapedCharactersMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return RequiredWithEscapedCharactersMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharactersMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedVoid { + return RequiredWithEscapedCharacters1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedBoolean { + return RequiredWithEscapedCharacters1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedNumber { + return RequiredWithEscapedCharacters1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedString { + return RequiredWithEscapedCharacters1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedList { + return RequiredWithEscapedCharacters1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1BoxedMap { + return RequiredWithEscapedCharacters1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): RequiredWithEscapedCharacters1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt new file mode 100644 index 00000000000..6a6008202bc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidation.kt @@ -0,0 +1,183 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.DoubleEnumValidator +import org.openapijsonschematools.client.schemas.validation.DoubleValueMethod +import org.openapijsonschematools.client.schemas.validation.FloatEnumValidator +import org.openapijsonschematools.client.schemas.validation.FloatValueMethod +import org.openapijsonschematools.client.schemas.validation.IntegerEnumValidator +import org.openapijsonschematools.client.schemas.validation.IntegerValueMethod +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.LongEnumValidator +import org.openapijsonschematools.client.schemas.validation.LongValueMethod +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SimpleEnumValidation { + // nest classes so all schemas and input/output classes can be public + + enum class IntegerSimpleEnumValidationEnums(private val value: Int): IntegerValueMethod { + POSITIVE_1(1), + POSITIVE_2(2), + POSITIVE_3(3); + + override fun value(): Int { + return this.value + } + } + + enum class LongSimpleEnumValidationEnums(private val value: Long): LongValueMethod { + POSITIVE_1(1L), + POSITIVE_2(2L), + POSITIVE_3(3L); + + override fun value(): Long { + return this.value + } + } + + enum class FloatSimpleEnumValidationEnums(private val value: Float): FloatValueMethod { + POSITIVE_1(1.0f), + POSITIVE_2(2.0f), + POSITIVE_3(3.0f); + + override fun value(): Float { + return this.value + } + } + + enum class DoubleSimpleEnumValidationEnums(private val value: Double): DoubleValueMethod { + POSITIVE_1(1.0), + POSITIVE_2(2.0), + POSITIVE_3(3.0); + + override fun value(): Double { + return this.value + } + } + + + sealed interface SimpleEnumValidation1Boxed { + fun getData(): Any? + } + + data class SimpleEnumValidation1BoxedNumber(val data: Number) : SimpleEnumValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class SimpleEnumValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .enumValues(setOf( + BigDecimal("1"), + BigDecimal("2"), + BigDecimal("3") + )) + ), IntegerEnumValidator, LongEnumValidator, FloatEnumValidator, DoubleEnumValidator, NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SimpleEnumValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SimpleEnumValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: IntegerSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int + } + + @Throws(ValidationException::class) + override fun validate(arg: LongSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long + } + + @Throws(ValidationException::class) + override fun validate(arg: FloatSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float + } + + @Throws(ValidationException::class) + override fun validate(arg: DoubleSimpleEnumValidationEnums, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SimpleEnumValidation1BoxedNumber { + return SimpleEnumValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SimpleEnumValidation1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt new file mode 100644 index 00000000000..bac24cd6f99 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependency.kt @@ -0,0 +1,317 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.AbstractMap +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SingleDependency { + // nest classes so all schemas and input/output classes can be public + + + sealed interface SingleDependency1Boxed { + fun getData(): Any? + } + + data class SingleDependency1BoxedVoid(val data: Nothing?) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedBoolean(val data: Boolean): SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedNumber(val data: Number) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedString(val data: String) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedList(val data: FrozenList) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + data class SingleDependency1BoxedMap(val data: FrozenMap) : SingleDependency1Boxed { + override fun getData(): Any? { + return data + } + } + + + class SingleDependency1 private constructor(): JsonSchema( + JsonSchemaInfo() + .dependentRequired(mapOf( + Pair( + "bar", + setOf( + "foo" + ) + ) + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, SingleDependency1BoxedList>, MapSchemaValidator, SingleDependency1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SingleDependency1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SingleDependency1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): SingleDependency1BoxedVoid { + return SingleDependency1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): SingleDependency1BoxedBoolean { + return SingleDependency1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SingleDependency1BoxedNumber { + return SingleDependency1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): SingleDependency1BoxedString { + return SingleDependency1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): SingleDependency1BoxedList { + return SingleDependency1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): SingleDependency1BoxedMap { + return SingleDependency1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SingleDependency1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt new file mode 100644 index 00000000000..73569f56e70 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeInteger.kt @@ -0,0 +1,112 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class SmallMultipleOfLargeInteger { + // nest classes so all schemas and input/output classes can be public + + + sealed interface SmallMultipleOfLargeInteger1Boxed { + fun getData(): Any? + } + + data class SmallMultipleOfLargeInteger1BoxedNumber(val data: Number) : SmallMultipleOfLargeInteger1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class SmallMultipleOfLargeInteger1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("int") + .multipleOf(BigDecimal("1.0E-8")) + ), NumberSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: SmallMultipleOfLargeInteger1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: SmallMultipleOfLargeInteger1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): SmallMultipleOfLargeInteger1BoxedNumber { + return SmallMultipleOfLargeInteger1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SmallMultipleOfLargeInteger1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt new file mode 100644 index 00000000000..029fbdd5f39 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStrings.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.StringJsonSchema + +class StringTypeMatchesStrings: StringJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class StringTypeMatchesStrings1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: StringTypeMatchesStrings1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringTypeMatchesStrings1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt new file mode 100644 index 00000000000..bd73df6d66c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TimeFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface TimeFormat1Boxed { + fun getData(): Any? + } + + data class TimeFormat1BoxedVoid(val data: Nothing?) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedBoolean(val data: Boolean): TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedNumber(val data: Number) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedString(val data: String) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedList(val data: FrozenList) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TimeFormat1BoxedMap(val data: FrozenMap) : TimeFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class TimeFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("time") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, TimeFormat1BoxedList>, MapSchemaValidator, TimeFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TimeFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TimeFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): TimeFormat1BoxedVoid { + return TimeFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): TimeFormat1BoxedBoolean { + return TimeFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): TimeFormat1BoxedNumber { + return TimeFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): TimeFormat1BoxedString { + return TimeFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): TimeFormat1BoxedList { + return TimeFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TimeFormat1BoxedMap { + return TimeFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TimeFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt new file mode 100644 index 00000000000..3c71f597a38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNull.kt @@ -0,0 +1,186 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TypeArrayObjectOrNull { + // nest classes so all schemas and input/output classes can be public + + + sealed interface TypeArrayObjectOrNull1Boxed { + fun getData(): Any? + } + + data class TypeArrayObjectOrNull1BoxedList(val data: FrozenList) : TypeArrayObjectOrNull1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TypeArrayObjectOrNull1BoxedMap(val data: FrozenMap) : TypeArrayObjectOrNull1Boxed { + override fun getData(): Any? { + return data + } + } + data class TypeArrayObjectOrNull1BoxedVoid(val data: Nothing?) : TypeArrayObjectOrNull1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class TypeArrayObjectOrNull1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + List::class.java, + Map::class.java, + Void::class.java + )) + ), ListSchemaValidator, TypeArrayObjectOrNull1BoxedList>, MapSchemaValidator, TypeArrayObjectOrNull1BoxedMap>, NullSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TypeArrayObjectOrNull1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TypeArrayObjectOrNull1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } else if (arg == null) { + return validate(null, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg == null) { + return getNewInstance(null, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1BoxedList { + return TypeArrayObjectOrNull1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1BoxedMap { + return TypeArrayObjectOrNull1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1BoxedVoid { + return TypeArrayObjectOrNull1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TypeArrayObjectOrNull1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } else if (arg == null) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt new file mode 100644 index 00000000000..2b051917725 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObject.kt @@ -0,0 +1,157 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class TypeArrayOrObject { + // nest classes so all schemas and input/output classes can be public + + + sealed interface TypeArrayOrObject1Boxed { + fun getData(): Any? + } + + data class TypeArrayOrObject1BoxedList(val data: FrozenList) : TypeArrayOrObject1Boxed { + override fun getData(): Any? { + return data + } + } + + data class TypeArrayOrObject1BoxedMap(val data: FrozenMap) : TypeArrayOrObject1Boxed { + override fun getData(): Any? { + return data + } + } + + + class TypeArrayOrObject1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + List::class.java, + Map::class.java + )) + ), ListSchemaValidator, TypeArrayOrObject1BoxedList>, MapSchemaValidator, TypeArrayOrObject1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: TypeArrayOrObject1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TypeArrayOrObject1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): TypeArrayOrObject1BoxedList { + return TypeArrayOrObject1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): TypeArrayOrObject1BoxedMap { + return TypeArrayOrObject1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): TypeArrayOrObject1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt new file mode 100644 index 00000000000..ff1319c4723 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItem.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.schemas.StringJsonSchema + +class TypeAsArrayWithOneItem: StringJsonSchema() { + // nest classes so all schemas and input/output classes can be public + + + class TypeAsArrayWithOneItem1 : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: TypeAsArrayWithOneItem1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: TypeAsArrayWithOneItem1().also { instance = it } + } + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt new file mode 100644 index 00000000000..fc183187285 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchema.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsAsSchema { + // nest classes so all schemas and input/output classes can be public + + + class UnevaluatedItems : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + } + + + sealed interface UnevaluateditemsAsSchema1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsAsSchema1BoxedVoid(val data: Nothing?) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedBoolean(val data: Boolean): UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedNumber(val data: Number) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedString(val data: String) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedList(val data: FrozenList) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsAsSchema1BoxedMap(val data: FrozenMap) : UnevaluateditemsAsSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluateditemsAsSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .unevaluatedItems(UnevaluatedItems::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluateditemsAsSchema1BoxedList>, MapSchemaValidator, UnevaluateditemsAsSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsAsSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsAsSchema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedVoid { + return UnevaluateditemsAsSchema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedBoolean { + return UnevaluateditemsAsSchema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedNumber { + return UnevaluateditemsAsSchema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedString { + return UnevaluateditemsAsSchema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedList { + return UnevaluateditemsAsSchema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1BoxedMap { + return UnevaluateditemsAsSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsAsSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt new file mode 100644 index 00000000000..2d3adc3a8cc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContains.kt @@ -0,0 +1,1688 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsDependsOnMultipleNestedContains { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ContainsBoxed { + fun getData(): Any? + } + + data class ContainsBoxedVoid(val data: Nothing?) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedBoolean(val data: Boolean): ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedNumber(val data: Number) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedString(val data: String) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedList(val data: FrozenList) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + data class ContainsBoxedMap(val data: FrozenMap) : ContainsBoxed { + override fun getData(): Any? { + return data + } + } + + + class Contains private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ContainsBoxedList>, MapSchemaValidator, ContainsBoxedMap> { + + companion object { + @Volatile + private var instance: Contains? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ContainsBoxedVoid { + return ContainsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ContainsBoxedBoolean { + return ContainsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ContainsBoxedNumber { + return ContainsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ContainsBoxedString { + return ContainsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ContainsBoxedList { + return ContainsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ContainsBoxedMap { + return ContainsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ContainsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema0Boxed { + fun getData(): Any? + } + + data class Schema0BoxedVoid(val data: Nothing?) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedBoolean(val data: Boolean): Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedNumber(val data: Number) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedString(val data: String) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedList(val data: FrozenList) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema0BoxedMap(val data: FrozenMap) : Schema0Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema0 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema0BoxedList>, MapSchemaValidator, Schema0BoxedMap> { + + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema0BoxedVoid { + return Schema0BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema0BoxedBoolean { + return Schema0BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema0BoxedNumber { + return Schema0BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema0BoxedString { + return Schema0BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema0BoxedList { + return Schema0BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema0BoxedMap { + return Schema0BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema0Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Contains1Boxed { + fun getData(): Any? + } + + data class Contains1BoxedVoid(val data: Nothing?) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedBoolean(val data: Boolean): Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedNumber(val data: Number) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedString(val data: String) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedList(val data: FrozenList) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Contains1BoxedMap(val data: FrozenMap) : Contains1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Contains1 private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("3")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Contains1BoxedList>, MapSchemaValidator, Contains1BoxedMap> { + + companion object { + @Volatile + private var instance: Contains1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Contains1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Contains1BoxedVoid { + return Contains1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Contains1BoxedBoolean { + return Contains1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Contains1BoxedNumber { + return Contains1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Contains1BoxedString { + return Contains1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Contains1BoxedList { + return Contains1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Contains1BoxedMap { + return Contains1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Contains1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface Schema1Boxed { + fun getData(): Any? + } + + data class Schema1BoxedVoid(val data: Nothing?) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedBoolean(val data: Boolean): Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedNumber(val data: Number) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedString(val data: String) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedList(val data: FrozenList) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class Schema1BoxedMap(val data: FrozenMap) : Schema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class Schema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .contains(Contains1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, Schema1BoxedList>, MapSchemaValidator, Schema1BoxedMap> { + + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): Schema1BoxedVoid { + return Schema1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): Schema1BoxedBoolean { + return Schema1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Schema1BoxedNumber { + return Schema1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): Schema1BoxedString { + return Schema1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): Schema1BoxedList { + return Schema1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): Schema1BoxedMap { + return Schema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Schema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface UnevaluatedItemsBoxed { + fun getData(): Any? + } + + data class UnevaluatedItemsBoxedVoid(val data: Nothing?) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedBoolean(val data: Boolean): UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedNumber(val data: Number) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedString(val data: String) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedList(val data: FrozenList) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedItemsBoxedMap(val data: FrozenMap) : UnevaluatedItemsBoxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedItems private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("5")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluatedItemsBoxedList>, MapSchemaValidator, UnevaluatedItemsBoxedMap> { + + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedVoid { + return UnevaluatedItemsBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedBoolean { + return UnevaluatedItemsBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedNumber { + return UnevaluatedItemsBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedString { + return UnevaluatedItemsBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedList { + return UnevaluatedItemsBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedItemsBoxedMap { + return UnevaluatedItemsBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedItemsBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid(val data: Nothing?) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean(val data: Boolean): UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber(val data: Number) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedString(val data: String) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedList(val data: FrozenList) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap(val data: FrozenMap) : UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluateditemsDependsOnMultipleNestedContains1 private constructor(): JsonSchema( + JsonSchemaInfo() + .allOf(listOf( + Schema0::class.java, + Schema1::class.java + )) + .unevaluatedItems(UnevaluatedItems::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluateditemsDependsOnMultipleNestedContains1BoxedList>, MapSchemaValidator, UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsDependsOnMultipleNestedContains1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsDependsOnMultipleNestedContains1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedString { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedList { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap { + return UnevaluateditemsDependsOnMultipleNestedContains1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsDependsOnMultipleNestedContains1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt new file mode 100644 index 00000000000..b420e31efe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItems.kt @@ -0,0 +1,180 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsWithItems { + // nest classes so all schemas and input/output classes can be public + + + class Items : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: Items? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Items().also { instance = it } + } + } + } + + + class UnevaluateditemsWithItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): UnevaluateditemsWithItemsList { + return UnevaluateditemsWithItems1.getInstance().validate(arg, configuration) + } + } + } + + class UnevaluateditemsWithItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Int): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): UnevaluateditemsWithItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class UnevaluatedItems : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + } + + + sealed interface UnevaluateditemsWithItems1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsWithItems1BoxedList(val data: UnevaluateditemsWithItemsList) : UnevaluateditemsWithItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + + class UnevaluateditemsWithItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(Items::class.java) + .unevaluatedItems(UnevaluatedItems::class.java) + ), ListSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsWithItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsWithItems1().also { instance = it } + } + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): UnevaluateditemsWithItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + if (!(itemInstance is Number)) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return UnevaluateditemsWithItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsWithItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsWithItems1BoxedList { + return UnevaluateditemsWithItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsWithItems1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt new file mode 100644 index 00000000000..d35f25274f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElements.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluateditemsWithNullInstanceElements { + // nest classes so all schemas and input/output classes can be public + + + class UnevaluatedItems : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedItems? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedItems().also { instance = it } + } + } + } + + + sealed interface UnevaluateditemsWithNullInstanceElements1Boxed { + fun getData(): Any? + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedVoid(val data: Nothing?) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedBoolean(val data: Boolean): UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedNumber(val data: Number) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedString(val data: String) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedList(val data: FrozenList) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluateditemsWithNullInstanceElements1BoxedMap(val data: FrozenMap) : UnevaluateditemsWithNullInstanceElements1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluateditemsWithNullInstanceElements1 private constructor(): JsonSchema( + JsonSchemaInfo() + .unevaluatedItems(UnevaluatedItems::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluateditemsWithNullInstanceElements1BoxedList>, MapSchemaValidator, UnevaluateditemsWithNullInstanceElements1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluateditemsWithNullInstanceElements1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluateditemsWithNullInstanceElements1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedVoid { + return UnevaluateditemsWithNullInstanceElements1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedBoolean { + return UnevaluateditemsWithNullInstanceElements1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedNumber { + return UnevaluateditemsWithNullInstanceElements1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedString { + return UnevaluateditemsWithNullInstanceElements1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedList { + return UnevaluateditemsWithNullInstanceElements1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1BoxedMap { + return UnevaluateditemsWithNullInstanceElements1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluateditemsWithNullInstanceElements1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt new file mode 100644 index 00000000000..ee836bf8c34 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynames.kt @@ -0,0 +1,390 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NumberJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesNotAffectedByPropertynames { + // nest classes so all schemas and input/output classes can be public + + + sealed interface PropertyNamesBoxed { + fun getData(): Any? + } + + data class PropertyNamesBoxedString(val data: String) : PropertyNamesBoxed { + override fun getData(): Any? { + return data + } + } + + + + class PropertyNames private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .maxLength(1) + ), StringSchemaValidator { + + companion object { + @Volatile + private var instance: PropertyNames? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: PropertyNames().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): PropertyNamesBoxedString { + return PropertyNamesBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): PropertyNamesBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + class UnevaluatedProperties : NumberJsonSchema.NumberJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + } + + + sealed interface UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid(val data: Nothing?) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean(val data: Boolean): UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber(val data: Number) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString(val data: String) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList(val data: FrozenList) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap(val data: FrozenMap) : UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesNotAffectedByPropertynames1 private constructor(): JsonSchema( + JsonSchemaInfo() + .propertyNames(PropertyNames::class.java) + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList>, MapSchemaValidator, UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesNotAffectedByPropertynames1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesNotAffectedByPropertynames1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap { + return UnevaluatedpropertiesNotAffectedByPropertynames1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesNotAffectedByPropertynames1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt new file mode 100644 index 00000000000..86fd9e41172 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchema.kt @@ -0,0 +1,177 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesSchema { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UnevaluatedPropertiesBoxed { + fun getData(): Any? + } + + data class UnevaluatedPropertiesBoxedString(val data: String) : UnevaluatedPropertiesBoxed { + override fun getData(): Any? { + return data + } + } + + + + class UnevaluatedProperties private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf( + String::class.java + )) + .minLength(3) + ), StringSchemaValidator { + + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedPropertiesBoxedString { + return UnevaluatedPropertiesBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedPropertiesBoxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface UnevaluatedpropertiesSchema1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesSchema1BoxedMap(val data: FrozenMap) : UnevaluatedpropertiesSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesSchema1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), MapSchemaValidator, UnevaluatedpropertiesSchema1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesSchema1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesSchema1BoxedMap { + return UnevaluatedpropertiesSchema1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt new file mode 100644 index 00000000000..e3e330a2380 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalproperties.kt @@ -0,0 +1,302 @@ +package org.openapijsonschematools.client.components.schemas +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.AnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.GenericBuilder +import org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapUtils +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesWithAdjacentAdditionalproperties { + // nest classes so all schemas and input/output classes can be public + + + class AdditionalProperties : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + companion object { + @Volatile + private var instance: AdditionalProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AdditionalProperties().also { instance = it } + } + } + } + + + class Foo : StringJsonSchema.StringJsonSchema1() { + companion object { + @Volatile + private var instance: Foo? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Foo().also { instance = it } + } + } + } + + + class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap(m: FrozenMap) : FrozenMap(m) { + companion object { + val requiredKeys: Set = setOf() + val optionalKeys: Set = setOf( + "foo" + ) + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap { + return UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance().validate(arg, configuration) + } + } + + @Throws(UnsetPropertyException::class) + fun foo(): String { + val key = "foo" + throwIfKeyNotPresent(key) + val value: Any? = get(key) + if (!(value is String)) { + throw RuntimeException("Invalid value stored for foo") + } + return value + } + + @Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) + fun getAdditionalProperty(name: String): Any? { + throwIfKeyKnown(name, requiredKeys, optionalKeys) + return getOrThrow(name) + } + } + + interface SetterForFoo { + fun getInstance(): MutableMap + fun getBuilderAfterFoo(instance: MutableMap): T + + fun foo(value: String): T { + val instance = getInstance() + instance["foo"] = value + return getBuilderAfterFoo(instance) + } + } + + interface SetterForAdditionalProperties { + fun getKnownKeys(): Set + fun getInstance(): MutableMap + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + } + + class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder: GenericBuilder>, SetterForFoo, SetterForAdditionalProperties { + private val knownKeys: Set = setOf( + "foo" + ) + override fun getKnownKeys(): Set { + return knownKeys + } + private val instance: MutableMap + init { + this.instance = LinkedHashMap() + } + override fun build(): Map { + return instance + } + override fun getInstance(): MutableMap { + return instance + } + override fun getBuilderAfterFoo(instance: MutableMap): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder { + return this + } + override fun getBuilderAfterAdditionalProperty(instance: MutableMap): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMapBuilder { + return this + } + } + + + class UnevaluatedProperties : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + } + + + sealed interface UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap(val data: UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap) : UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesWithAdjacentAdditionalproperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties(mapOf( + "foo" to Foo::class.java + )) + .additionalProperties(AdditionalProperties::class.java) + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), MapSchemaValidator { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesWithAdjacentAdditionalproperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesWithAdjacentAdditionalproperties1().also { instance = it } + } + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap { + val properties: LinkedHashMap = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap(castProperties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithAdjacentAdditionalpropertiesMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap { + return UnevaluatedpropertiesWithAdjacentAdditionalproperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithAdjacentAdditionalproperties1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt new file mode 100644 index 00000000000..0d7fe4b2706 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstanceProperties.kt @@ -0,0 +1,322 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.NullJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UnevaluatedpropertiesWithNullValuedInstanceProperties { + // nest classes so all schemas and input/output classes can be public + + + class UnevaluatedProperties : NullJsonSchema.NullJsonSchema1() { + companion object { + @Volatile + private var instance: UnevaluatedProperties? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedProperties().also { instance = it } + } + } + } + + + sealed interface UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + fun getData(): Any? + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid(val data: Nothing?) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean(val data: Boolean): UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber(val data: Number) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString(val data: String) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList(val data: FrozenList) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap(val data: FrozenMap) : UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UnevaluatedpropertiesWithNullValuedInstanceProperties1 private constructor(): JsonSchema( + JsonSchemaInfo() + .unevaluatedProperties(UnevaluatedProperties::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList>, MapSchemaValidator, UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UnevaluatedpropertiesWithNullValuedInstanceProperties1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnevaluatedpropertiesWithNullValuedInstanceProperties1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap { + return UnevaluatedpropertiesWithNullValuedInstanceProperties1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnevaluatedpropertiesWithNullValuedInstanceProperties1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt new file mode 100644 index 00000000000..525bbb087f7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsFalseValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsFalseValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsFalseValidation1BoxedVoid(val data: Nothing?) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedBoolean(val data: Boolean): UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedNumber(val data: Number) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedString(val data: String) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedList(val data: FrozenList) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseValidation1BoxedMap(val data: FrozenMap) : UniqueitemsFalseValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsFalseValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(false) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsFalseValidation1BoxedList>, MapSchemaValidator, UniqueitemsFalseValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsFalseValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsFalseValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedVoid { + return UniqueitemsFalseValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedBoolean { + return UniqueitemsFalseValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedNumber { + return UniqueitemsFalseValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedString { + return UniqueitemsFalseValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedList { + return UniqueitemsFalseValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1BoxedMap { + return UniqueitemsFalseValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsFalseValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt new file mode 100644 index 00000000000..f123e252e5a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItems.kt @@ -0,0 +1,408 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsFalseWithAnArrayOfItems { + // nest classes so all schemas and input/output classes can be public + + + class UniqueitemsFalseWithAnArrayOfItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItemsList { + return UniqueitemsFalseWithAnArrayOfItems1.getInstance().validate(arg, configuration) + } + } + } + + class UniqueitemsFalseWithAnArrayOfItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): UniqueitemsFalseWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface UniqueitemsFalseWithAnArrayOfItems1Boxed { + fun getData(): Any? + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedVoid(val data: Nothing?) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean(val data: Boolean): UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedNumber(val data: Number) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedString(val data: String) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedList(val data: UniqueitemsFalseWithAnArrayOfItemsList) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsFalseWithAnArrayOfItems1BoxedMap(val data: FrozenMap) : UniqueitemsFalseWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsFalseWithAnArrayOfItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(false) + .prefixItems(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, UniqueitemsFalseWithAnArrayOfItems1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsFalseWithAnArrayOfItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsFalseWithAnArrayOfItems1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): UniqueitemsFalseWithAnArrayOfItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return UniqueitemsFalseWithAnArrayOfItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedVoid { + return UniqueitemsFalseWithAnArrayOfItems1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean { + return UniqueitemsFalseWithAnArrayOfItems1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedNumber { + return UniqueitemsFalseWithAnArrayOfItems1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedString { + return UniqueitemsFalseWithAnArrayOfItems1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedList { + return UniqueitemsFalseWithAnArrayOfItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1BoxedMap { + return UniqueitemsFalseWithAnArrayOfItems1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsFalseWithAnArrayOfItems1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt new file mode 100644 index 00000000000..181ba3a42b5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidation.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsValidation { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UniqueitemsValidation1Boxed { + fun getData(): Any? + } + + data class UniqueitemsValidation1BoxedVoid(val data: Nothing?) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedBoolean(val data: Boolean): UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedNumber(val data: Number) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedString(val data: String) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedList(val data: FrozenList) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsValidation1BoxedMap(val data: FrozenMap) : UniqueitemsValidation1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsValidation1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(true) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UniqueitemsValidation1BoxedList>, MapSchemaValidator, UniqueitemsValidation1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsValidation1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsValidation1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedVoid { + return UniqueitemsValidation1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedBoolean { + return UniqueitemsValidation1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedNumber { + return UniqueitemsValidation1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedString { + return UniqueitemsValidation1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedList { + return UniqueitemsValidation1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsValidation1BoxedMap { + return UniqueitemsValidation1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsValidation1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt new file mode 100644 index 00000000000..aa941473131 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItems.kt @@ -0,0 +1,408 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.BooleanJsonSchema +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UniqueitemsWithAnArrayOfItems { + // nest classes so all schemas and input/output classes can be public + + + class UniqueitemsWithAnArrayOfItemsList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItemsList { + return UniqueitemsWithAnArrayOfItems1.getInstance().validate(arg, configuration) + } + } + } + + class UniqueitemsWithAnArrayOfItemsListBuilder { + // class to build List + private val list: MutableList + + init { + this.list = ArrayList() + } + + + fun add(item: Nothing?): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(null) + return this + } + + fun add(item: Boolean): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: String): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Int): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Float): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Long): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Double): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List<*>): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun add(item: Map): UniqueitemsWithAnArrayOfItemsListBuilder { + list.add(item) + return this + } + + fun build(): List { + return list + } + } + + + class Schema0 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema0? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema0().also { instance = it } + } + } + } + + + class Schema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: Schema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Schema1().also { instance = it } + } + } + } + + + sealed interface UniqueitemsWithAnArrayOfItems1Boxed { + fun getData(): Any? + } + + data class UniqueitemsWithAnArrayOfItems1BoxedVoid(val data: Nothing?) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedBoolean(val data: Boolean): UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedNumber(val data: Number) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedString(val data: String) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedList(val data: UniqueitemsWithAnArrayOfItemsList) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UniqueitemsWithAnArrayOfItems1BoxedMap(val data: FrozenMap) : UniqueitemsWithAnArrayOfItems1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UniqueitemsWithAnArrayOfItems1 private constructor(): JsonSchema( + JsonSchemaInfo() + .uniqueItems(true) + .prefixItems(listOf( + Schema0::class.java, + Schema1::class.java + )) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, MapSchemaValidator, UniqueitemsWithAnArrayOfItems1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UniqueitemsWithAnArrayOfItems1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UniqueitemsWithAnArrayOfItems1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): UniqueitemsWithAnArrayOfItemsList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return UniqueitemsWithAnArrayOfItemsList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItemsList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedVoid { + return UniqueitemsWithAnArrayOfItems1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedBoolean { + return UniqueitemsWithAnArrayOfItems1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedNumber { + return UniqueitemsWithAnArrayOfItems1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedString { + return UniqueitemsWithAnArrayOfItems1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedList { + return UniqueitemsWithAnArrayOfItems1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1BoxedMap { + return UniqueitemsWithAnArrayOfItems1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UniqueitemsWithAnArrayOfItems1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt new file mode 100644 index 00000000000..46a606e7c80 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriFormat1Boxed { + fun getData(): Any? + } + + data class UriFormat1BoxedVoid(val data: Nothing?) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedBoolean(val data: Boolean): UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedNumber(val data: Number) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedString(val data: String) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedList(val data: FrozenList) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriFormat1BoxedMap(val data: FrozenMap) : UriFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriFormat1BoxedList>, MapSchemaValidator, UriFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriFormat1BoxedVoid { + return UriFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriFormat1BoxedBoolean { + return UriFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriFormat1BoxedNumber { + return UriFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriFormat1BoxedString { + return UriFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriFormat1BoxedList { + return UriFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriFormat1BoxedMap { + return UriFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt new file mode 100644 index 00000000000..7bdbafd17e5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriReferenceFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriReferenceFormat1Boxed { + fun getData(): Any? + } + + data class UriReferenceFormat1BoxedVoid(val data: Nothing?) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedBoolean(val data: Boolean): UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedNumber(val data: Number) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedString(val data: String) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedList(val data: FrozenList) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriReferenceFormat1BoxedMap(val data: FrozenMap) : UriReferenceFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriReferenceFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-reference") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriReferenceFormat1BoxedList>, MapSchemaValidator, UriReferenceFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriReferenceFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriReferenceFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedVoid { + return UriReferenceFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedBoolean { + return UriReferenceFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedNumber { + return UriReferenceFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedString { + return UriReferenceFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedList { + return UriReferenceFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriReferenceFormat1BoxedMap { + return UriReferenceFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriReferenceFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt new file mode 100644 index 00000000000..6bfbac6b213 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UriTemplateFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UriTemplateFormat1Boxed { + fun getData(): Any? + } + + data class UriTemplateFormat1BoxedVoid(val data: Nothing?) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedBoolean(val data: Boolean): UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedNumber(val data: Number) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedString(val data: String) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedList(val data: FrozenList) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UriTemplateFormat1BoxedMap(val data: FrozenMap) : UriTemplateFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UriTemplateFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uri-template") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UriTemplateFormat1BoxedList>, MapSchemaValidator, UriTemplateFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UriTemplateFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UriTemplateFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedVoid { + return UriTemplateFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedBoolean { + return UriTemplateFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedNumber { + return UriTemplateFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedString { + return UriTemplateFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedList { + return UriTemplateFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UriTemplateFormat1BoxedMap { + return UriTemplateFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UriTemplateFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt new file mode 100644 index 00000000000..d4d16481ada --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormat.kt @@ -0,0 +1,308 @@ +package org.openapijsonschematools.client.components.schemas +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class UuidFormat { + // nest classes so all schemas and input/output classes can be public + + + sealed interface UuidFormat1Boxed { + fun getData(): Any? + } + + data class UuidFormat1BoxedVoid(val data: Nothing?) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedBoolean(val data: Boolean): UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedNumber(val data: Number) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedString(val data: String) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedList(val data: FrozenList) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UuidFormat1BoxedMap(val data: FrozenMap) : UuidFormat1Boxed { + override fun getData(): Any? { + return data + } + } + + + class UuidFormat1 private constructor(): JsonSchema( + JsonSchemaInfo() + .format("uuid") + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, UuidFormat1BoxedList>, MapSchemaValidator, UuidFormat1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: UuidFormat1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidFormat1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UuidFormat1BoxedVoid { + return UuidFormat1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UuidFormat1BoxedBoolean { + return UuidFormat1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UuidFormat1BoxedNumber { + return UuidFormat1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidFormat1BoxedString { + return UuidFormat1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UuidFormat1BoxedList { + return UuidFormat1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UuidFormat1BoxedMap { + return UuidFormat1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidFormat1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt new file mode 100644 index 00000000000..088e740f01a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElse.kt @@ -0,0 +1,1136 @@ +package org.openapijsonschematools.client.components.schemas +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.UnsetAddPropsSetter +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +class ValidateAgainstCorrectBranchThenVsElse { + // nest classes so all schemas and input/output classes can be public + + + sealed interface ElseSchemaBoxed { + fun getData(): Any? + } + + data class ElseSchemaBoxedVoid(val data: Nothing?) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedBoolean(val data: Boolean): ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedNumber(val data: Number) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedString(val data: String) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedList(val data: FrozenList) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class ElseSchemaBoxedMap(val data: FrozenMap) : ElseSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class ElseSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .multipleOf(BigDecimal("2")) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ElseSchemaBoxedList>, MapSchemaValidator, ElseSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: ElseSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ElseSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ElseSchemaBoxedVoid { + return ElseSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ElseSchemaBoxedBoolean { + return ElseSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ElseSchemaBoxedNumber { + return ElseSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ElseSchemaBoxedString { + return ElseSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ElseSchemaBoxedList { + return ElseSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ElseSchemaBoxedMap { + return ElseSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ElseSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface IfSchemaBoxed { + fun getData(): Any? + } + + data class IfSchemaBoxedVoid(val data: Nothing?) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedBoolean(val data: Boolean): IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedNumber(val data: Number) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedString(val data: String) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedList(val data: FrozenList) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + data class IfSchemaBoxedMap(val data: FrozenMap) : IfSchemaBoxed { + override fun getData(): Any? { + return data + } + } + + + class IfSchema private constructor(): JsonSchema( + JsonSchemaInfo() + .exclusiveMaximum(0) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, IfSchemaBoxedList>, MapSchemaValidator, IfSchemaBoxedMap> { + + companion object { + @Volatile + private var instance: IfSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IfSchema().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): IfSchemaBoxedVoid { + return IfSchemaBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): IfSchemaBoxedBoolean { + return IfSchemaBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IfSchemaBoxedNumber { + return IfSchemaBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): IfSchemaBoxedString { + return IfSchemaBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): IfSchemaBoxedList { + return IfSchemaBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): IfSchemaBoxedMap { + return IfSchemaBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IfSchemaBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ThenBoxed { + fun getData(): Any? + } + + data class ThenBoxedVoid(val data: Nothing?) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedBoolean(val data: Boolean): ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedNumber(val data: Number) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedString(val data: String) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedList(val data: FrozenList) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + data class ThenBoxedMap(val data: FrozenMap) : ThenBoxed { + override fun getData(): Any? { + return data + } + } + + + class Then private constructor(): JsonSchema( + JsonSchemaInfo() + .minimum(-10) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ThenBoxedList>, MapSchemaValidator, ThenBoxedMap> { + + companion object { + @Volatile + private var instance: Then? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Then().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ThenBoxedVoid { + return ThenBoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ThenBoxedBoolean { + return ThenBoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ThenBoxedNumber { + return ThenBoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ThenBoxedString { + return ThenBoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ThenBoxedList { + return ThenBoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ThenBoxedMap { + return ThenBoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ThenBoxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } + + sealed interface ValidateAgainstCorrectBranchThenVsElse1Boxed { + fun getData(): Any? + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedVoid(val data: Nothing?) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean(val data: Boolean): ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedNumber(val data: Number) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedString(val data: String) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedList(val data: FrozenList) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + data class ValidateAgainstCorrectBranchThenVsElse1BoxedMap(val data: FrozenMap) : ValidateAgainstCorrectBranchThenVsElse1Boxed { + override fun getData(): Any? { + return data + } + } + + + class ValidateAgainstCorrectBranchThenVsElse1 private constructor(): JsonSchema( + JsonSchemaInfo() + .ifSchema(IfSchema::class.java) + .then(Then::class.java) + .elseSchema(ElseSchema::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, NumberSchemaValidator, StringSchemaValidator, ListSchemaValidator, ValidateAgainstCorrectBranchThenVsElse1BoxedList>, MapSchemaValidator, ValidateAgainstCorrectBranchThenVsElse1BoxedMap> { + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + */ + + companion object { + @Volatile + private var instance: ValidateAgainstCorrectBranchThenVsElse1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ValidateAgainstCorrectBranchThenVsElse1().also { instance = it } + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(itemInstance) + i += 1 + } + val newInstanceItems: FrozenList = FrozenList(items) + return newInstanceItems + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties: LinkedHashMap = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[propertyName] = propertyInstance + } + val castProperties: FrozenMap = FrozenMap(properties) + return castProperties + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedVoid { + return ValidateAgainstCorrectBranchThenVsElse1BoxedVoid(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean { + return ValidateAgainstCorrectBranchThenVsElse1BoxedBoolean(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedNumber { + return ValidateAgainstCorrectBranchThenVsElse1BoxedNumber(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedString { + return ValidateAgainstCorrectBranchThenVsElse1BoxedString(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedList { + return ValidateAgainstCorrectBranchThenVsElse1BoxedList(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1BoxedMap { + return ValidateAgainstCorrectBranchThenVsElse1BoxedMap(validate(arg, configuration)) + } + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ValidateAgainstCorrectBranchThenVsElse1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt new file mode 100644 index 00000000000..93aa9a04917 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlags.kt @@ -0,0 +1,446 @@ +package org.openapijsonschematools.client.configurations; + +data class JsonSchemaKeywordFlags( + val additionalProperties: Boolean, + val allOf: Boolean, + val anyOf: Boolean, + val const_: Boolean, + val contains: Boolean, + val dependentRequired: Boolean, + val dependentSchemas: Boolean, + val discriminator: Boolean, + val else_: Boolean, + val enum_: Boolean, + val exclusiveMaximum: Boolean, + val exclusiveMinimum: Boolean, + val format: Boolean, + val if_: Boolean, + val maximum: Boolean, + val minimum: Boolean, + val items: Boolean, + val maxContains: Boolean, + val maxItems: Boolean, + val maxLength: Boolean, + val maxProperties: Boolean, + val minContains: Boolean, + val minItems: Boolean, + val minLength: Boolean, + val minProperties: Boolean, + val multipleOf: Boolean, + val not: Boolean, + val oneOf: Boolean, + val pattern: Boolean, + val patternProperties: Boolean, + val prefixItems: Boolean, + val properties: Boolean, + val propertyNames: Boolean, + val required: Boolean, + val then: Boolean, + val type: Boolean, + val uniqueItems: Boolean, + val unevaluatedItems: Boolean, + val unevaluatedProperties: Boolean +) { + val keywords: LinkedHashSet + get() { + val enabledKeywords = LinkedHashSet() + if (additionalProperties) { + enabledKeywords.add("additionalProperties") + } + if (allOf) { + enabledKeywords.add("allOf") + } + if (anyOf) { + enabledKeywords.add("anyOf") + } + if (const_) { + enabledKeywords.add("const") + } + if (contains) { + enabledKeywords.add("contains") + } + if (dependentRequired) { + enabledKeywords.add("dependentRequired") + } + if (dependentSchemas) { + enabledKeywords.add("dependentSchemas") + } + if (discriminator) { + enabledKeywords.add("discriminator") + } + if (else_) { + enabledKeywords.add("else_") + } + if (enum_) { + enabledKeywords.add("enum_") + } + if (exclusiveMaximum) { + enabledKeywords.add("exclusiveMaximum") + } + if (exclusiveMinimum) { + enabledKeywords.add("exclusiveMinimum") + } + if (format) { + enabledKeywords.add("format") + } + if (if_) { + enabledKeywords.add("if_") + } + if (maximum) { + enabledKeywords.add("maximum") + } + if (minimum) { + enabledKeywords.add("minimum") + } + if (items) { + enabledKeywords.add("items") + } + if (maxContains) { + enabledKeywords.add("maxContains") + } + if (maxItems) { + enabledKeywords.add("maxItems") + } + if (maxLength) { + enabledKeywords.add("maxLength") + } + if (maxProperties) { + enabledKeywords.add("maxProperties") + } + if (minContains) { + enabledKeywords.add("minContains") + } + if (minItems) { + enabledKeywords.add("minItems") + } + if (minLength) { + enabledKeywords.add("minLength") + } + if (minProperties) { + enabledKeywords.add("minProperties") + } + if (multipleOf) { + enabledKeywords.add("multipleOf") + } + if (not) { + enabledKeywords.add("not") + } + if (oneOf) { + enabledKeywords.add("oneOf") + } + if (pattern) { + enabledKeywords.add("pattern") + } + if (patternProperties) { + enabledKeywords.add("patternProperties") + } + if (prefixItems) { + enabledKeywords.add("prefixItems") + } + if (properties) { + enabledKeywords.add("properties") + } + if (propertyNames) { + enabledKeywords.add("propertyNames") + } + if (required) { + enabledKeywords.add("required") + } + if (then) { + enabledKeywords.add("then") + } + if (type) { + enabledKeywords.add("type") + } + if (uniqueItems) { + enabledKeywords.add("uniqueItems") + } + if (unevaluatedItems) { + enabledKeywords.add("unevaluatedItems") + } + if (unevaluatedProperties) { + enabledKeywords.add("unevaluatedProperties") + } + return enabledKeywords + } + + class Builder { + private var additionalProperties = false + private var allOf = false + private var anyOf = false + private var const_ = false + private var contains = false + private var dependentRequired = false + private var dependentSchemas = false + private var discriminator = false + private var else_ = false + private var enum_ = false + private var exclusiveMaximum = false + private var exclusiveMinimum = false + private var format = false + private var if_ = false + private var maximum = false + private var minimum = false + private var items = false + private var maxContains = false + private var maxItems = false + private var maxLength = false + private var maxProperties = false + private var minContains = false + private var minItems = false + private var minLength = false + private var minProperties = false + private var multipleOf = false + private var not = false + private var oneOf = false + private var pattern = false + private var patternProperties = false + private var prefixItems = false + private var properties = false + private var propertyNames = false + private var required = false + private var then = false + private var type = false + private var uniqueItems = false + private var unevaluatedItems = false + private var unevaluatedProperties = false + fun additionalProperties(): Builder { + additionalProperties = true + return this + } + + fun allOf(): Builder { + allOf = true + return this + } + + fun anyOf(): Builder { + anyOf = true + return this + } + + fun const_(): Builder { + const_ = true + return this + } + + fun contains(): Builder { + contains = true + return this + } + + fun dependentRequired(): Builder { + dependentRequired = true + return this + } + + fun dependentSchemas(): Builder { + dependentSchemas = true + return this + } + + fun discriminator(): Builder { + discriminator = true + return this + } + + fun else_(): Builder { + else_ = true + return this + } + + fun enum_(): Builder { + enum_ = true + return this + } + + fun exclusiveMaximum(): Builder { + exclusiveMaximum = true + return this + } + + fun exclusiveMinimum(): Builder { + exclusiveMinimum = true + return this + } + + fun format(): Builder { + format = true + return this + } + + fun if_(): Builder { + if_ = true + return this + } + + fun maximum(): Builder { + maximum = true + return this + } + + fun minimum(): Builder { + minimum = true + return this + } + + fun items(): Builder { + items = true + return this + } + + fun maxContains(): Builder { + maxContains = true + return this + } + + fun maxItems(): Builder { + maxItems = true + return this + } + + fun maxLength(): Builder { + maxLength = true + return this + } + + fun maxProperties(): Builder { + maxProperties = true + return this + } + + fun minContains(): Builder { + minContains = true + return this + } + + fun minItems(): Builder { + minItems = true + return this + } + + fun minLength(): Builder { + minLength = true + return this + } + + fun minProperties(): Builder { + minProperties = true + return this + } + + fun multipleOf(): Builder { + multipleOf = true + return this + } + + operator fun not(): Builder { + not = true + return this + } + + fun oneOf(): Builder { + oneOf = true + return this + } + + fun pattern(): Builder { + pattern = true + return this + } + + fun patternProperties(): Builder { + patternProperties = true + return this + } + + fun prefixItems(): Builder { + prefixItems = true + return this + } + + fun properties(): Builder { + properties = true + return this + } + + fun propertyNames(): Builder { + propertyNames = true + return this + } + + fun required(): Builder { + required = true + return this + } + + fun then(): Builder { + then = true + return this + } + + fun type(): Builder { + type = true + return this + } + + fun uniqueItems(): Builder { + uniqueItems = true + return this + } + + fun unevaluatedItems(): Builder { + unevaluatedItems = true + return this + } + + fun unevaluatedProperties(): Builder { + unevaluatedProperties = true + return this + } + + fun build(): JsonSchemaKeywordFlags { + return JsonSchemaKeywordFlags( + additionalProperties, + allOf, + anyOf, + const_, + contains, + dependentRequired, + dependentSchemas, + discriminator, + else_, + enum_, + exclusiveMaximum, + exclusiveMinimum, + format, + if_, + maximum, + minimum, + items, + maxContains, + maxItems, + maxLength, + maxProperties, + minContains, + minItems, + minLength, + minProperties, + multipleOf, + not, + oneOf, + pattern, + patternProperties, + prefixItems, + properties, + propertyNames, + required, + then, + type, + uniqueItems, + unevaluatedItems, + unevaluatedProperties + ) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt new file mode 100644 index 00000000000..39a58bba52f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/configurations/SchemaConfiguration.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.configurations; + +data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt new file mode 100644 index 00000000000..90fd1cd37f1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/BaseException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt new file mode 100644 index 00000000000..ad5b703ba4e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/InvalidAdditionalPropertyException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class InvalidAdditionalPropertyException(s: String?) : BaseException(s) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt new file mode 100644 index 00000000000..6bff93968fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/UnsetPropertyException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt new file mode 100644 index 00000000000..f9ea00d0821 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/exceptions/ValidationException.kt @@ -0,0 +1,3 @@ +package org.openapijsonschematools.client.exceptions; + +class ValidationException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt new file mode 100644 index 00000000000..816976afa8f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/AnyTypeJsonSchema.kt @@ -0,0 +1,358 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class AnyTypeJsonSchema { + sealed interface AnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class AnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class AnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, StringSchemaValidator, + ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedVoid { + return AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedBoolean { + return AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedNumber { + return AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedString { + return AnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedList { + return AnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedMap { + return AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: AnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt new file mode 100644 index 00000000000..ec466c5b84e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/BooleanJsonSchema.kt @@ -0,0 +1,78 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class BooleanJsonSchema { + sealed interface BooleanJsonSchema1Boxed { + fun getData(): Any? + } + + data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class BooleanJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + ), BooleanSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Boolean { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BooleanJsonSchema1BoxedBoolean { + return BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BooleanJsonSchema1Boxed { + if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: BooleanJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt new file mode 100644 index 00000000000..ff7a15d365a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate + +open class DateJsonSchema { + sealed interface DateJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is LocalDate) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateJsonSchema1BoxedString { + return DateJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt new file mode 100644 index 00000000000..4da3ee275fe --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DateTimeJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.ZonedDateTime + +open class DateTimeJsonSchema { + sealed interface DateTimeJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateTimeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date-time") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is ZonedDateTime) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeJsonSchema1BoxedString { + return DateTimeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateTimeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt new file mode 100644 index 00000000000..f327b015a82 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DecimalJsonSchema.kt @@ -0,0 +1,78 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class DecimalJsonSchema { + sealed interface DecimalJsonSchema1Boxed { + fun getData(): Any? + } + + data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DecimalJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("number") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DecimalJsonSchema1BoxedString { + return DecimalJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DecimalJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DecimalJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DecimalJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt new file mode 100644 index 00000000000..ac9981b8d46 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/DoubleJsonSchema.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class DoubleJsonSchema { + sealed interface DoubleJsonSchema1Boxed { + fun getData(): Any? + } + + data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DoubleJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + .format("double") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DoubleJsonSchema1BoxedNumber { + return DoubleJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DoubleJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DoubleJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DoubleJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt new file mode 100644 index 00000000000..016d1ef2e43 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/FloatJsonSchema.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class FloatJsonSchema { + sealed interface FloatJsonSchema1Boxed { + fun getData(): Any? + } + + data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class FloatJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf( + Int::class.java, + Float::class.java + )) + .format("float") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatJsonSchema1BoxedNumber { + return FloatJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: FloatJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt new file mode 100644 index 00000000000..f96e858458c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/GenericBuilder.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas + +/** + * Builders must implement this class + * @param the type that the builder returns + */ +interface GenericBuilder { + fun build(): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt new file mode 100644 index 00000000000..fba8ab8762a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int32JsonSchema.kt @@ -0,0 +1,93 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class Int32JsonSchema { + sealed interface Int32JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int32JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Float::class.java + ) + ) + .format("int32") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int32JsonSchema1BoxedNumber { + return Int32JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int32JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int32JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int32JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt new file mode 100644 index 00000000000..8feda5d3694 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/Int64JsonSchema.kt @@ -0,0 +1,105 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class Int64JsonSchema { + sealed interface Int64JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int64JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int64") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int64JsonSchema1BoxedNumber { + return Int64JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int64JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int64JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int64JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt new file mode 100644 index 00000000000..0a0043e7335 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/IntJsonSchema.kt @@ -0,0 +1,105 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class IntJsonSchema { + sealed interface IntJsonSchema1Boxed { + fun getData(): Any? + } + + data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class IntJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IntJsonSchema1BoxedNumber { + return IntJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IntJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: IntJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt new file mode 100644 index 00000000000..eff37e367ff --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/ListJsonSchema.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class ListJsonSchema { + sealed interface ListJsonSchema1Boxed { + fun getData(): Any? + } + + data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class ListJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + ), ListSchemaValidator, ListJsonSchema1BoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ListJsonSchema1BoxedList { + return ListJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ListJsonSchema1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ListJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ListJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt new file mode 100644 index 00000000000..a1e0ecc6842 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/MapJsonSchema.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class MapJsonSchema { + sealed interface MapJsonSchema1Boxed { + fun getData(): Any? + } + + data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class MapJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + ), MapSchemaValidator, MapJsonSchema1BoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MapJsonSchema1BoxedMap { + return MapJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MapJsonSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: MapJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MapJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..f0992da3100 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NotAnyTypeJsonSchema.kt @@ -0,0 +1,379 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.BooleanSchemaValidator +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class NotAnyTypeJsonSchema { + sealed interface NotAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class NotAnyTypeJsonSchema1BoxedVoid(val data: Void?) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NotAnyTypeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null as Void?, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null as Void?, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1BoxedVoid { + return NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Boolean, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedBoolean { + return NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Number, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedNumber { + return NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: String, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedString { + return NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedList { + return NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedMap { + return NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + var instance: NotAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = NotAnyTypeJsonSchema1() + } + return field + } + private set + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt new file mode 100644 index 00000000000..b926c2cdb7c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NullJsonSchema.kt @@ -0,0 +1,77 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NullSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class NullJsonSchema { + sealed interface NullJsonSchema1Boxed { + fun getData(): Any? + } + + data class NullJsonSchema1BoxedVoid(val data: Nothing?) : NullJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NullJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Void::class.java)) + ), NullSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance(null, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NullJsonSchema1BoxedVoid { + return NullJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NullJsonSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NullJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullJsonSchema1().also { instance = it } + } + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt new file mode 100644 index 00000000000..7f29d2a96a9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/NumberJsonSchema.kt @@ -0,0 +1,104 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.NumberSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +open class NumberJsonSchema { + sealed interface NumberJsonSchema1Boxed { + fun getData(): Any? + } + + data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NumberJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NumberJsonSchema1BoxedNumber { + return NumberJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NumberJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NumberJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt new file mode 100644 index 00000000000..29f8b0f77f3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/StringJsonSchema.kt @@ -0,0 +1,111 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class StringJsonSchema { + interface StringJsonSchema1Boxed { + fun getData(): Any? + } + + data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class StringJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + when (arg) { + is UUID -> { + return validate(arg, configuration) + } + + is LocalDate -> { + return validate(arg, configuration) + } + + is ZonedDateTime -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): StringJsonSchema1BoxedString { + return StringJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): StringJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: StringJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt new file mode 100644 index 00000000000..320112a061d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UnsetAddPropsSetter.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException +import org.openapijsonschematools.client.schemas.validation.MapUtils + +interface UnsetAddPropsSetter { + fun getInstance(): MutableMap + fun getKnownKeys(): Set + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Void): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List<*>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt new file mode 100644 index 00000000000..5586af2b501 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/UuidJsonSchema.kt @@ -0,0 +1,87 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.StringSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.util.UUID + +open class UuidJsonSchema { + sealed interface UuidJsonSchema1Boxed { + fun getData(): Any? + } + + data class UuidJsonSchema1BoxedString(val data: String) : UuidJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class UuidJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("uuid") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is UUID) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidJsonSchema1BoxedString { + return UuidJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: UuidJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt new file mode 100644 index 00000000000..c7123fd5823 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidator.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AdditionalPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val additionalProperties: Class> = data.schema.additionalProperties ?: return null + val presentAdditionalProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentAdditionalProperties.add(key) + } + } + val properties: Map>>? = data.schema.properties + if (properties != null) { + presentAdditionalProperties.removeAll(properties.keys) + } + val pathToSchemas = PathToSchemasMap() + for (addPropName in presentAdditionalProperties) { + val propValue: Any? = data.arg.get(addPropName) + val propPathToItem: List = data.validationMetadata.pathToItem + addPropName + if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas + .containsKey(propPathToItem) + ) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties) + if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt new file mode 100644 index 00000000000..e81a1aebfa6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AllOfValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AllOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val allOf: List>> = data.schema.allOf ?: return null + val pathToSchemas = PathToSchemasMap() + for (allOfClass in allOf) { + val allOfSchema = JsonSchemaFactory.getInstance(allOfClass) + val otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt new file mode 100644 index 00000000000..b264835903b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/AnyOfValidator.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class AnyOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val anyOf: List>> = data.schema.anyOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedAnyOfClasses: MutableList>> = ArrayList() + for (anyOfClass in anyOf) { + if (anyOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke _validate on it because that is recursive + */ + validatedAnyOfClasses.add(anyOfClass) + continue + } + try { + val anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass) + val otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg, data.validationMetadata) + validatedAnyOfClasses.add(anyOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate anyof_classes + } + } + if (validatedAnyOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass.simpleName + ". None " + + "of the anyOf schemas matched the input data." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt new file mode 100644 index 00000000000..7d9535004a2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BigDecimalValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +abstract class BigDecimalValidator { + @Throws(ValidationException::class) + protected fun getBigDecimal(arg: Number): BigDecimal { + return when (arg) { + is Int -> { + BigDecimal(arg) + } + + is Long -> { + BigDecimal(arg) + } + + is Float -> { + BigDecimal(arg.toString()) + } + + is Double -> { + BigDecimal(arg.toString()) + } + + else -> { + throw ValidationException("Invalid type input for arg") + } + } + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt new file mode 100644 index 00000000000..a6a943fd3b3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface BooleanEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Boolean +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt new file mode 100644 index 00000000000..acdd61917b7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface BooleanSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean + + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt new file mode 100644 index 00000000000..1843f88eae3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/BooleanValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface BooleanValueMethod { + fun value(): Boolean +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt new file mode 100644 index 00000000000..9ecd5a5534f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ConstValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class ConstValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (!data.schema.constValueSet) { + return null + } + val constValue: Any? = data.schema.constValue + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (castArg == constValue) { + return null + } + if (constValue is BigDecimal && constValue.compareTo(castArg) == 0) { + return null + } + } else { + if (data.arg == constValue) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not equal to const " + constValue) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt new file mode 100644 index 00000000000..133e45944c0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ContainsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List? = data.containsPathToSchemas + if (containsPathToSchemas.isNullOrEmpty()) { + throw ValidationException( + "Validation failed for contains keyword in class=${data.schema.javaClass}" + + " at pathToItem=${data.validationMetadata.pathToItem}. No " + + "items validated to the contains schema." + ) + } + val pathToSchemas = PathToSchemasMap() + for (otherPathToSchema in containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt new file mode 100644 index 00000000000..65afa14827f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparser.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.time.ZonedDateTime +import java.time.LocalDate + +class CustomIsoparser { + companion object { + fun parseIsodatetime(dateTime: String): ZonedDateTime { + return ZonedDateTime.parse(dateTime) + } + + fun parseIsodate(date: String): LocalDate { + return LocalDate.parse(date) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt new file mode 100644 index 00000000000..7f8a8cbfddd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DefaultValueMethod.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DefaultValueMethod { + @Throws(ValidationException::class) + fun defaultValue(): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt new file mode 100644 index 00000000000..d968b55d980 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentRequiredValidator.kt @@ -0,0 +1,36 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class DependentRequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentRequired: Map> = data.schema.dependentRequired ?: return null + for ((key, value) in dependentRequired.entries) { + if (!data.arg.containsKey(key)) { + continue + } + val missingKeys: MutableSet = HashSet(value) + for (objKey in data.arg.keys) { + if (objKey is String) { + missingKeys.remove(objKey) + } + } + if (missingKeys.isEmpty()) { + continue + } + throw ValidationException(""" + |Validation failed for dependentRequired because these_keys=$missingKeys are + | missing at pathToItem=${data.validationMetadata.pathToItem} in class + | ${data.schema.javaClass} + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt new file mode 100644 index 00000000000..889ede258bc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DependentSchemasValidator.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class DependentSchemasValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentSchemas: Map>> = data.schema.dependentSchemas ?: return null + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, dependentSchemaClass) in dependentSchemas.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass) + val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt new file mode 100644 index 00000000000..d2f2abe26bb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface DoubleEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Double +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt new file mode 100644 index 00000000000..72223e0152a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/DoubleValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface DoubleValueMethod { + fun value(): Double +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt new file mode 100644 index 00000000000..9cf161f6255 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ElseValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ElseValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val elseSchema: Class> = data.schema.elseSchema ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (!ifPathToSchemas.isEmpty()) { + // if validation is true + return null + } + val elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema) + val pathToSchemas = PathToSchemasMap() + val elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an else error? + pathToSchemas.update(elsePathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt new file mode 100644 index 00000000000..f07075606ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/EnumValidator.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class EnumValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val enumValues: Set = data.schema.enumValues ?: return null + if (enumValues.isEmpty()) { + throw ValidationException("No value can match enum because enum is empty") + } + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (enumContainsArg(enumValues, castArg)) { + return null + } + for (enumValue in enumValues) { + if (enumValue is BigDecimal && enumValue.compareTo(castArg) == 0) { + return null + } + } + } else { + if (enumContainsArg(enumValues, data.arg)) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not one of the allowed enum " + enumValues) + } + + companion object { + private fun enumContainsArg(enumValues: Set, arg: Any?): Boolean { + return enumValues.contains(arg) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt new file mode 100644 index 00000000000..5b55d46a38d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMaximumValidator.kt @@ -0,0 +1,43 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ExclusiveMaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMaximum: Number = data.schema.exclusiveMaximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt new file mode 100644 index 00000000000..e19f44defe9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ExclusiveMinimumValidator.kt @@ -0,0 +1,43 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ExclusiveMinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMinimum: Number = data.schema.exclusiveMinimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMinimum.toInt()) < 1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMinimum.toLong()) < 1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMinimum.toFloat()) < 1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMinimum.toDouble()) < 1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt new file mode 100644 index 00000000000..9603f2a6468 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface FloatEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Float +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt new file mode 100644 index 00000000000..23a2817fc0e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FloatValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface FloatValueMethod { + fun value(): Float +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt new file mode 100644 index 00000000000..47673b8c868 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidator.kt @@ -0,0 +1,168 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException +import java.math.BigDecimal +import java.math.BigInteger +import java.time.format.DateTimeParseException +import java.util.UUID +import kotlin.math.floor + +class FormatValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val format: String = data.schema.format ?: return null + if (data.arg is Number) { + validateNumericFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } else if (data.arg is String) { + validateStringFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } + return null + } + + companion object { + private val int32InclusiveMinimum = BigInteger.valueOf(-2147483648L) + private val int32InclusiveMaximum = BigInteger.valueOf(2147483647L) + private val int64InclusiveMinimum = BigInteger.valueOf(Long.MIN_VALUE) + private val int64InclusiveMaximum = BigInteger.valueOf(Long.MAX_VALUE) + private val floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38) + private val floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38) + private val doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308) + private val doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308) + @Throws(ValidationException::class) + private fun validateNumericFormat(arg: Number, validationMetadata: ValidationMetadata, format: String) { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + val intArg: BigInteger + when (arg) { + is Float, is Double -> { + val doubleArg: Double = (arg as? Float)?.toDouble() ?: arg as Double + if (floor(doubleArg) != doubleArg) { + throw ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem + ) + } + intArg = if (arg is Float) { + val smallInt = Math.round(arg) + BigInteger.valueOf(smallInt.toLong()) + } else { + BigInteger.valueOf(Math.round((arg as Double))) + } + } + + is Int -> { + intArg = BigInteger.valueOf(arg.toLong()) + } + + is Long -> { + intArg = BigInteger.valueOf(arg) + } + + else -> { + intArg = arg as BigInteger + } + } + if (format == "int32") { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem + ) + } + } else if (format == "int64") { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem + ) + } + } + } else if (format == "float" || format == "double") { + val decimalArg: BigDecimal = when (arg) { + is Float -> { + BigDecimal.valueOf(arg.toDouble()) + } + + is Double -> { + BigDecimal.valueOf(arg) + } + + else -> { + arg as BigDecimal + } + } + if (format == "float") { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format float at " + validationMetadata.pathToItem + ) + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format double at " + validationMetadata.pathToItem + ) + } + } + } + } + + @Throws(ValidationException::class) + private fun validateStringFormat(arg: String, validationMetadata: ValidationMetadata, format: String) { + when (format) { + "uuid" -> { + try { + UUID.fromString(arg) + } catch (e: IllegalArgumentException) { + throw ValidationException( + "Value cannot be converted to a UUID. Invalid value " + + arg + " for format uuid at " + validationMetadata.pathToItem + ) + } + } + + "number" -> { + try { + BigDecimal(arg) + } catch (e: NumberFormatException) { + throw ValidationException( + "Value cannot be converted to a decimal. Invalid value " + + arg + " for format number at " + validationMetadata.pathToItem + ) + } + } + + "date" -> { + try { + CustomIsoparser.parseIsodate(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 date format. " + + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem + ) + } + } + + "date-time" -> { + try { + CustomIsoparser.parseIsodatetime(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 datetime format. " + + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt new file mode 100644 index 00000000000..94451c44c38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenList.kt @@ -0,0 +1,22 @@ +package org.openapijsonschematools.client.schemas.validation + +open class FrozenList(m: Collection) : AbstractList() { + /* + A frozen List + Once schema validation has been run, indexed access returns values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val list: List + + init { + list = ArrayList(m) + } + + override val size: Int + get() = list.size + + override fun get(index: Int): E { + return list[index] + } +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt new file mode 100644 index 00000000000..cce76fb8bad --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/FrozenMap.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.UnsetPropertyException +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException + +open class FrozenMap(m: Map) : AbstractMap() { + /* + A frozen Map + Once schema validation has been run, written accessor methods return values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val map: Map + + init { + map = HashMap(m) + } + + @Throws(UnsetPropertyException::class) + protected fun getOrThrow(key: String): V? { + if (containsKey(key)) { + return get(key) + } + throw UnsetPropertyException("$key is unset") + } + + @Throws(UnsetPropertyException::class) + protected fun throwIfKeyNotPresent(key: String) { + if (!containsKey(key)) { + throw UnsetPropertyException("$key is unset") + } + } + + @Throws(InvalidAdditionalPropertyException::class) + protected fun throwIfKeyKnown(key: String, requiredKeys: Set, optionalKeys: Set) { + val knownKeys: MutableSet = HashSet() + knownKeys.addAll(requiredKeys) + knownKeys.addAll(optionalKeys) + MapUtils.throwIfKeyKnown(key, knownKeys, false) + } + + override val entries: Set> + get() = map.entries +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt new file mode 100644 index 00000000000..2a55d6b3528 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IfValidator.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class IfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.ifSchema == null) { + return null + } + if (data.ifPathToSchemas == null) { + throw ValidationException("Invalid type for ifPathToSchemas") + } + /* + if is false use case + ifPathToSchemas == {} + no need to add any data to pathToSchemas + + if true, then true -> true for whole schema + so validate_then will add ifPathToSchemas data to pathToSchemas + */ + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt new file mode 100644 index 00000000000..210f0e4dea7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface IntegerEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Int +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt new file mode 100644 index 00000000000..84961e6aa44 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/IntegerValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface IntegerValueMethod { + fun value(): Int +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt new file mode 100644 index 00000000000..b4f7e9b9a77 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidator.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val items: Class> = data.schema.items ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val itemsSchema = JsonSchemaFactory.getInstance(items) + for (i in minIndex until data.arg.size) { + val itemPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt new file mode 100644 index 00000000000..a4e79ca4c1a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchema.kt @@ -0,0 +1,512 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.regex.Pattern +import java.util.UUID + +abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { + val type: Set>? + val format: String? + val items: Class>? + val properties: Map>>? + val required: Set? + val exclusiveMaximum: Number? + val exclusiveMinimum: Number? + val maxItems: Int? + val minItems: Int? + val maxLength: Int? + val minLength: Int? + val maxProperties: Int? + val minProperties: Int? + val maximum: Number? + val minimum: Number? + val multipleOf: BigDecimal? + val additionalProperties: Class>? + val allOf: List>>? + val anyOf: List>>? + val oneOf: List>>? + val not: Class>? + val uniqueItems: Boolean? + val enumValues: Set? + val pattern: Pattern? + val defaultValue: Any? + val defaultValueSet: Boolean + val constValue: Any? + val constValueSet: Boolean + val contains: Class>? + val maxContains: Int? + val minContains: Int? + val propertyNames: Class>? + val dependentRequired: Map>? + val dependentSchemas: Map>>? + val patternProperties: Map>>? + val prefixItems: List>>? + val ifSchema: Class>? + val then: Class>? + val elseSchema: Class>? + val unevaluatedItems: Class>? + val unevaluatedProperties: Class>? + private val keywordToValidator: LinkedHashMap + + init { + val keywordToValidator = LinkedHashMap() + type = jsonSchemaInfo.type + if (type != null) { + keywordToValidator["type"] = TypeValidator() + } + format = jsonSchemaInfo.format + if (format != null) { + keywordToValidator["format"] = FormatValidator() + } + items = jsonSchemaInfo.items + if (items != null) { + keywordToValidator["items"] = ItemsValidator() + } + properties = jsonSchemaInfo.properties + if (properties != null) { + keywordToValidator["properties"] = PropertiesValidator() + } + required = jsonSchemaInfo.required + if (required != null) { + keywordToValidator["required"] = RequiredValidator() + } + exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum + if (exclusiveMaximum != null) { + keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() + } + exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum + if (exclusiveMinimum != null) { + keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() + } + maxItems = jsonSchemaInfo.maxItems + if (maxItems != null) { + keywordToValidator["maxItems"] = MaxItemsValidator() + } + minItems = jsonSchemaInfo.minItems + if (minItems != null) { + keywordToValidator["minItems"] = MinItemsValidator() + } + maxLength = jsonSchemaInfo.maxLength + if (maxLength != null) { + keywordToValidator["maxLength"] = MaxLengthValidator() + } + minLength = jsonSchemaInfo.minLength + if (minLength != null) { + keywordToValidator["minLength"] = MinLengthValidator() + } + maxProperties = jsonSchemaInfo.maxProperties + if (maxProperties != null) { + keywordToValidator["maxProperties"] = MaxPropertiesValidator() + } + minProperties = jsonSchemaInfo.minProperties + if (minProperties != null) { + keywordToValidator["minProperties"] = MinPropertiesValidator() + } + maximum = jsonSchemaInfo.maximum + if (maximum != null) { + keywordToValidator["maximum"] = MaximumValidator() + } + minimum = jsonSchemaInfo.minimum + if (minimum != null) { + keywordToValidator["minimum"] = MinimumValidator() + } + multipleOf = jsonSchemaInfo.multipleOf + if (multipleOf != null) { + keywordToValidator["multipleOf"] = MultipleOfValidator() + } + additionalProperties = jsonSchemaInfo.additionalProperties + if (additionalProperties != null) { + keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() + } + allOf = jsonSchemaInfo.allOf + if (allOf != null) { + keywordToValidator["allOf"] = AllOfValidator() + } + anyOf = jsonSchemaInfo.anyOf + if (anyOf != null) { + keywordToValidator["anyOf"] = AnyOfValidator() + } + oneOf = jsonSchemaInfo.oneOf + if (oneOf != null) { + keywordToValidator["oneOf"] = OneOfValidator() + } + not = jsonSchemaInfo.not + if (not != null) { + keywordToValidator["not"] = NotValidator() + } + uniqueItems = jsonSchemaInfo.uniqueItems + if (uniqueItems != null) { + keywordToValidator["uniqueItems"] = UniqueItemsValidator() + } + enumValues = jsonSchemaInfo.enumValues + if (enumValues != null) { + keywordToValidator["enum"] = EnumValidator() + } + pattern = jsonSchemaInfo.pattern + if (pattern != null) { + keywordToValidator["pattern"] = PatternValidator() + } + defaultValue = jsonSchemaInfo.defaultValue + defaultValueSet = jsonSchemaInfo.defaultValueSet + constValue = jsonSchemaInfo.constValue + constValueSet = jsonSchemaInfo.constValueSet + if (constValueSet) { + keywordToValidator["const"] = ConstValidator() + } + contains = jsonSchemaInfo.contains + if (contains != null) { + keywordToValidator["contains"] = ContainsValidator() + } + maxContains = jsonSchemaInfo.maxContains + if (maxContains != null) { + keywordToValidator["maxContains"] = MaxContainsValidator() + } + minContains = jsonSchemaInfo.minContains + if (minContains != null) { + keywordToValidator["minContains"] = MinContainsValidator() + } + propertyNames = jsonSchemaInfo.propertyNames + if (propertyNames != null) { + keywordToValidator["propertyNames"] = PropertyNamesValidator() + } + dependentRequired = jsonSchemaInfo.dependentRequired + if (dependentRequired != null) { + keywordToValidator["dependentRequired"] = DependentRequiredValidator() + } + dependentSchemas = jsonSchemaInfo.dependentSchemas + if (dependentSchemas != null) { + keywordToValidator["dependentSchemas"] = DependentSchemasValidator() + } + patternProperties = jsonSchemaInfo.patternProperties + if (patternProperties != null) { + keywordToValidator["patternProperties"] = PatternPropertiesValidator() + } + prefixItems = jsonSchemaInfo.prefixItems + if (prefixItems != null) { + keywordToValidator["prefixItems"] = PrefixItemsValidator() + } + ifSchema = jsonSchemaInfo.ifSchema + if (ifSchema != null) { + keywordToValidator["if"] = IfValidator() + } + then = jsonSchemaInfo.then + if (then != null) { + keywordToValidator["then"] = ThenValidator() + } + elseSchema = jsonSchemaInfo.elseSchema + if (elseSchema != null) { + keywordToValidator["else"] = ElseValidator() + } + unevaluatedItems = jsonSchemaInfo.unevaluatedItems + if (unevaluatedItems != null) { + keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() + } + unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties + if (unevaluatedProperties != null) { + keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() + } + this.keywordToValidator = keywordToValidator + } + + abstract fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? + @Throws(ValidationException::class) + abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? + @Throws(ValidationException::class) + abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T + private fun getContainsPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): List { + if (arg !is List<*> || contains == null) { + return ArrayList() + } + val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) + val containsPathToSchemas: MutableList = ArrayList() + for (i in arg.indices) { + val thesePathToSchemas = PathToSchemasMap() + val itemPathToItem: List = validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(containsSchema)) { + // todo add_deeper_validated_schemas + containsPathToSchemas.add(thesePathToSchemas) + continue + } + try { + val otherPathToSchemas = validate( + containsSchema, arg[i], itemValidationMetadata + ) + containsPathToSchemas.add(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + } + return containsPathToSchemas + } + + @Throws(ValidationException::class) + private fun getPatternPropertiesPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (arg !is Map<*, *> || patternProperties == null) { + return PathToSchemasMap() + } + val pathToSchemas = PathToSchemasMap() + for ((key, value) in arg) { + val entryKey = key!! as? String + ?: throw ValidationException("Invalid non-string type for map key") + val propPathToItem: List = validationMetadata.pathToItem + entryKey + val propValidationMetadata = ValidationMetadata( + propPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + for ((key1, patternPropClass) in patternProperties) { + if (!key1.matcher(entryKey).find()) { + continue + } + val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) + val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + } + return pathToSchemas + } + + private fun getIfPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (ifSchema == null) { + return PathToSchemasMap() + } + val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) + val pathToSchemas = PathToSchemasMap() + try { + val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + return pathToSchemas + } + + protected fun castToAllowedTypes(arg: String, pathToItem: List, pathSet: MutableSet>): String { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List, pathSet: MutableSet>): Boolean { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Number, pathToItem: List, pathSet: MutableSet>): Number { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Nothing?, pathToItem: List, pathSet: MutableSet>): Nothing? { + pathSet.add(pathToItem) + return arg + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List, pathSet: MutableSet>): List<*> { + pathSet.add(pathToItem) + val argFixed: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val newPathToItem: List = pathToItem + i + val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) + argFixed.add(fixedVal) + i += 1 + } + return argFixed + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes( + arg: Map<*, *>, + pathToItem: List, + pathSet: MutableSet> + ): Map<*, *> { + pathSet.add(pathToItem) + val argFixed = LinkedHashMap() + for ((entryKey, value) in arg) { + if (entryKey !is String) { + throw ValidationException("Invalid non-string key value") + } + val newPathToItem: List = pathToItem + entryKey + val fixedVal = castToAllowedObjectTypes(value, newPathToItem, pathSet) + argFixed[entryKey] = fixedVal + } + return argFixed + } + + @Throws(ValidationException::class) + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { + return when (arg) { + null -> { + castToAllowedTypes(null, pathToItem, pathSet) + } + is String -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Map<*, *> -> { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Boolean -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Number -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is List<*> -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is ZonedDateTime -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is LocalDate -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is UUID -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + else -> { + val argClass = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + } + } + } + + protected fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { + return arg + } + + protected fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + return arg + } + + protected fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { + return arg + } + + protected fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + return arg + } + + companion object { + @Throws(ValidationException::class) + fun validate( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + val disabledKeywords: LinkedHashSet = + validationMetadata.configuration.disabledKeywordFlags.keywords + val pathToSchemas = PathToSchemasMap() + val thisKeywordToValidator = jsonSchema.keywordToValidator + var containsPathToSchemas: List? = null + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) + } + var patternPropertiesPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) + } + var ifPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) + } + var knownPathToSchemas: PathToSchemasMap? = null + for ((jsonKeyword, validator) in thisKeywordToValidator) { + if (disabledKeywords.contains(jsonKeyword)) { + val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format + if (!typeIntegerUseCase) { + continue + } + } + if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { + knownPathToSchemas = pathToSchemas + } + val data = ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ) + val otherPathToSchemas = validator.validate(data) ?: continue + pathToSchemas.update(otherPathToSchemas) + } + val pathToItem: List = validationMetadata.pathToItem + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + } + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] + if (schemas != null) { + schemas[jsonSchema] = null + } + return pathToSchemas + } + + @JvmStatic + @Throws(ValidationException::class) + protected fun getPathToSchemas( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata, + pathSet: Set> + ): PathToSchemasMap { + val pathToSchemasMap = PathToSchemasMap() + // todo add check of validationMetadata.validationRanEarlier(this) + val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) + pathToSchemasMap.update(otherPathToSchemas) + for (schemas in pathToSchemasMap.values) { + val firstSchema: JsonSchema<*> = schemas.entries.iterator().next().key + schemas.clear() + schemas[firstSchema] = null + } + val mutPathSet: MutableSet> = pathSet.toMutableSet() + mutPathSet.removeAll(pathToSchemasMap.keys) + if (mutPathSet.isNotEmpty()) { + val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() + unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null + for (pathToItem in mutPathSet) { + pathToSchemasMap[pathToItem] = unsetAnyTypeSchema + } + } + return pathToSchemasMap + } + + fun getClass(arg: Any?): String { + return if (arg == null) { + Void::class.java.getSimpleName() + } else { + arg.javaClass.getSimpleName() + } + } // todo add bytes and FileIO + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt new file mode 100644 index 00000000000..3de64242080 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaFactory.kt @@ -0,0 +1,30 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.lang.reflect.InvocationTargetException + +object JsonSchemaFactory { + private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() + + fun > getInstance(schemaCls: Class): V { + val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] + cacheInst?.let { + assert(schemaCls.isInstance(it)) + return schemaCls.cast(it) + } + try { + val companion = schemaCls.declaredClasses[0] + val method = companion.getMethod("getInstance") + val obj = method.invoke(companion.kotlin.objectInstance) + assert(schemaCls.isInstance(obj)) + val inst = schemaCls.cast(obj) + classToInstance[schemaCls] = inst + return inst + } catch (e: NoSuchMethodException) { + throw RuntimeException(e) + } catch (e: IllegalAccessException) { + throw RuntimeException(e) + } catch (e: InvocationTargetException) { + throw RuntimeException(e) + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt new file mode 100644 index 00000000000..b36f28c46a4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaInfo.kt @@ -0,0 +1,244 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.math.BigDecimal +import java.util.regex.Pattern + +class JsonSchemaInfo { + var type: Set>? = null + fun type(type: Set>): JsonSchemaInfo { + this.type = type + return this + } + + var format: String? = null + fun format(format: String): JsonSchemaInfo { + this.format = format + return this + } + + var items: Class>? = null + fun items(items: Class>): JsonSchemaInfo { + this.items = items + return this + } + + var properties: Map>>? = null + fun properties(properties: Map>>): JsonSchemaInfo { + this.properties = properties + return this + } + + var required: Set? = null + fun required(required: Set): JsonSchemaInfo { + this.required = required + return this + } + + var exclusiveMaximum: Number? = null + fun exclusiveMaximum(exclusiveMaximum: Number): JsonSchemaInfo { + this.exclusiveMaximum = exclusiveMaximum + return this + } + + var exclusiveMinimum: Number? = null + fun exclusiveMinimum(exclusiveMinimum: Number): JsonSchemaInfo { + this.exclusiveMinimum = exclusiveMinimum + return this + } + + var maxItems: Int? = null + fun maxItems(maxItems: Int): JsonSchemaInfo { + this.maxItems = maxItems + return this + } + + var minItems: Int? = null + fun minItems(minItems: Int): JsonSchemaInfo { + this.minItems = minItems + return this + } + + var maxLength: Int? = null + fun maxLength(maxLength: Int): JsonSchemaInfo { + this.maxLength = maxLength + return this + } + + var minLength: Int? = null + fun minLength(minLength: Int): JsonSchemaInfo { + this.minLength = minLength + return this + } + + var maxProperties: Int? = null + fun maxProperties(maxProperties: Int): JsonSchemaInfo { + this.maxProperties = maxProperties + return this + } + + var minProperties: Int? = null + fun minProperties(minProperties: Int): JsonSchemaInfo { + this.minProperties = minProperties + return this + } + + var maximum: Number? = null + fun maximum(maximum: Number): JsonSchemaInfo { + this.maximum = maximum + return this + } + + var minimum: Number? = null + fun minimum(minimum: Number): JsonSchemaInfo { + this.minimum = minimum + return this + } + + var multipleOf: BigDecimal? = null + fun multipleOf(multipleOf: BigDecimal): JsonSchemaInfo { + this.multipleOf = multipleOf + return this + } + + var additionalProperties: Class>? = null + fun additionalProperties(additionalProperties: Class>): JsonSchemaInfo { + this.additionalProperties = additionalProperties + return this + } + + var allOf: List>>? = null + fun allOf(allOf: List>>): JsonSchemaInfo { + this.allOf = allOf + return this + } + + var anyOf: List>>? = null + fun anyOf(anyOf: List>>): JsonSchemaInfo { + this.anyOf = anyOf + return this + } + + var oneOf: List>>? = null + fun oneOf(oneOf: List>>): JsonSchemaInfo { + this.oneOf = oneOf + return this + } + + var not: Class>? = null + fun not(not: Class>): JsonSchemaInfo { + this.not = not + return this + } + + var uniqueItems: Boolean? = null + fun uniqueItems(uniqueItems: Boolean): JsonSchemaInfo { + this.uniqueItems = uniqueItems + return this + } + + var enumValues: Set? = null + fun enumValues(enumValues: Set): JsonSchemaInfo { + this.enumValues = enumValues + return this + } + + var pattern: Pattern? = null + fun pattern(pattern: Pattern): JsonSchemaInfo { + this.pattern = pattern + return this + } + + var defaultValue: Any? = null + var defaultValueSet = false + fun defaultValue(defaultValue: Any?): JsonSchemaInfo { + this.defaultValue = defaultValue + defaultValueSet = true + return this + } + + var constValue: Any? = null + var constValueSet = false + fun constValue(constValue: Any?): JsonSchemaInfo { + this.constValue = constValue + constValueSet = true + return this + } + + var contains: Class>? = null + fun contains(contains: Class>): JsonSchemaInfo { + this.contains = contains + return this + } + + var maxContains: Int? = null + fun maxContains(maxContains: Int): JsonSchemaInfo { + this.maxContains = maxContains + return this + } + + var minContains: Int? = null + fun minContains(minContains: Int): JsonSchemaInfo { + this.minContains = minContains + return this + } + + var propertyNames: Class>? = null + fun propertyNames(propertyNames: Class>): JsonSchemaInfo { + this.propertyNames = propertyNames + return this + } + + var dependentRequired: Map>? = null + fun dependentRequired(dependentRequired: Map>): JsonSchemaInfo { + this.dependentRequired = dependentRequired + return this + } + + var dependentSchemas: Map>>? = null + fun dependentSchemas(dependentSchemas: Map>>): JsonSchemaInfo { + this.dependentSchemas = dependentSchemas + return this + } + + var patternProperties: Map>>? = null + fun patternProperties(patternProperties: Map>>): JsonSchemaInfo { + this.patternProperties = patternProperties + return this + } + + var prefixItems: List>>? = null + fun prefixItems(prefixItems: List>>): JsonSchemaInfo { + this.prefixItems = prefixItems + return this + } + + var ifSchema: Class>? = null + fun ifSchema(ifSchema: Class>): JsonSchemaInfo { + this.ifSchema = ifSchema + return this + } + + var then: Class>? = null + fun then(then: Class>): JsonSchemaInfo { + this.then = then + return this + } + + var elseSchema: Class>? = null + fun elseSchema(elseSchema: Class>): JsonSchemaInfo { + this.elseSchema = elseSchema + return this + } + + var unevaluatedItems: Class>? = null + fun unevaluatedItems(unevaluatedItems: Class>): JsonSchemaInfo { + this.unevaluatedItems = unevaluatedItems + return this + } + + var unevaluatedProperties: Class>? = null + fun unevaluatedProperties(unevaluatedProperties: Class>): JsonSchemaInfo { + this.unevaluatedProperties = unevaluatedProperties + return this + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt new file mode 100644 index 00000000000..59e9d5bec4f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordEntry.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.util.AbstractMap + +class KeywordEntry(key: String, value: KeywordValidator) : + AbstractMap.SimpleEntry(key, value) diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt new file mode 100644 index 00000000000..c707681f8bf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/KeywordValidator.kt @@ -0,0 +1,10 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +fun interface KeywordValidator { + @Throws(ValidationException::class) + fun validate( + data: ValidationData + ): PathToSchemasMap? +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt new file mode 100644 index 00000000000..50a273b85eb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LengthValidator.kt @@ -0,0 +1,16 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.text.BreakIterator + +abstract class LengthValidator { + protected fun getLength(text: String?): Int { + var graphemeCount = 0 + val graphemeCounter = BreakIterator + .getCharacterInstance() + graphemeCounter.setText(text) + while (graphemeCounter.next() != BreakIterator.DONE) { + graphemeCount++ + } + return graphemeCount + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt new file mode 100644 index 00000000000..59c8c533bb2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ListSchemaValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface ListSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt new file mode 100644 index 00000000000..c8fc6db061f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface LongEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Long +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt new file mode 100644 index 00000000000..8d1f0ddc419 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/LongValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface LongValueMethod { + fun value(): Long +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt new file mode 100644 index 00000000000..bf11248a121 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapSchemaValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface MapSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt new file mode 100644 index 00000000000..5e6a8383648 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MapUtils.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.InvalidAdditionalPropertyException + +class MapUtils { + companion object { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value + } + return map + } + + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { + if (knownKeys.contains(key)) { + var verb = "getting" + if (setting) { + verb = "setting" + } + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt new file mode 100644 index 00000000000..3783b2da69e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxContainsValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxContains: Int = data.schema.maxContains ?: return null + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List = data.containsPathToSchemas ?: return null + if (containsPathToSchemas.size > maxContains) { + throw ValidationException(""" + |Validation failed for maxContains keyword in class=${data.schema.javaClass} + | at pathToItem=${data.validationMetadata.pathToItem}. Too many items" + | validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt new file mode 100644 index 00000000000..d18c07d9b79 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxItemsValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxItems: Int = data.schema.maxItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size > maxItems) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxItems of $maxItems") + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt new file mode 100644 index 00000000000..ca9c267dbd9 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxLengthValidator.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxLength: Int = data.schema.maxLength ?: return null + if (data.arg !is String) { + return null + } + val length: Int = getLength(data.arg) + if (length > maxLength) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxLength of $maxLength") + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt new file mode 100644 index 00000000000..1287a6b789f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaxPropertiesValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaxPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxProperties: Int = data.schema.maxProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size > maxProperties) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxProperties of $maxProperties") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt new file mode 100644 index 00000000000..b8070b6c4d1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MaximumValidator.kt @@ -0,0 +1,42 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maximum: Number = data.schema.maximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is > the maximum of " + maximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(maximum.toInt()) > 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(maximum.toLong()) > 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(maximum.toFloat()) > 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(maximum.toDouble()) > 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt new file mode 100644 index 00000000000..73b74a6b3aa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinContainsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minContains: Int = data.schema.minContains ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.containsPathToSchemas == null) { + return null + } + if (data.containsPathToSchemas.size < minContains) { + throw ValidationException(""" + |Validation failed for minContains keyword in class=${data.schema.javaClass} at + | pathToItem=${data.validationMetadata.pathToItem}. + | Too few items validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt new file mode 100644 index 00000000000..0f92b86cdc8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinItemsValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minItems: Int = data.schema.minItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size < minItems) { + throw ValidationException("Value ${data.arg} is invalid because has < the minItems of $minItems") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt new file mode 100644 index 00000000000..95228a8e132 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinLengthValidator.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minLength: Int = data.schema.minLength ?: return null + if (data.arg !is String) { + return null + } + val length = getLength(data.arg) + if (length < minLength) { + throw ValidationException("Value ${data.arg} is invalid because has < the minLength of $minLength") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt new file mode 100644 index 00000000000..01a2828c523 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.kt @@ -0,0 +1,19 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minProperties: Int = data.schema.minProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size < minProperties) { + throw ValidationException("Value ${data.arg} is invalid because has < the minProperties of $minProperties") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt new file mode 100644 index 00000000000..89cfc38f73a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MinimumValidator.kt @@ -0,0 +1,42 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class MinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minimum: Number = data.schema.minimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is < the minimum of " + minimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(minimum.toInt()) < 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(minimum.toLong()) < 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(minimum.toFloat()) < 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(minimum.toDouble()) < 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt new file mode 100644 index 00000000000..a1bf8794ae3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.kt @@ -0,0 +1,23 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.math.BigDecimal + +class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val multipleOf: BigDecimal = data.schema.multipleOf ?: return null + if (data.arg !is Number) { + return null + } + val castArg: BigDecimal = getBigDecimal(data.arg) + val msg = "Value ${data.arg} is invalid because it is not a multiple of $multipleOf" + if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { + throw ValidationException(msg) + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt new file mode 100644 index 00000000000..fe2eeaa2dfa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NotValidator.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class NotValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val not: Class> = data.schema.not ?: return null + val pathToSchemas: PathToSchemasMap = try { + val notSchema = JsonSchemaFactory.getInstance(not) + JsonSchema.validate(notSchema, data.arg, data.validationMetadata) + } catch (e: ValidationException) { + return null + } + if (!pathToSchemas.isEmpty()) { + throw ValidationException( + "Invalid value " + data.arg + " was passed in to " + data.schema.javaClass + + ". Value is invalid because it is disallowed by not " + not + ) + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt new file mode 100644 index 00000000000..7f3f09ebd70 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NullEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Nothing? +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt new file mode 100644 index 00000000000..b0e8462d4cf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NullSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? + + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt new file mode 100644 index 00000000000..291eac2a663 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NullValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface NullValueMethod { + fun value(): Nothing? +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt new file mode 100644 index 00000000000..cf4b7e2365b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/NumberSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface NumberSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number + + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt new file mode 100644 index 00000000000..b11ae07f2c5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/OneOfValidator.kt @@ -0,0 +1,45 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class OneOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val oneOf: List>> = data.schema.oneOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedOneOfClasses: MutableList>> = ArrayList() + for (oneOfClass in oneOf) { + if (oneOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke validate on it because that is recursive + */ + validatedOneOfClasses.add(oneOfClass) + continue + } + try { + val oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass) + val otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg, data.validationMetadata) + validatedOneOfClasses.add(oneOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate validatedOneOfClasses + } + } + if (validatedOneOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + ". None " + + "of the oneOf schemas matched the input data." + ) + } + if (validatedOneOfClasses.size > 1) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + + ". Multiple oneOf schemas validated the data, but a max of one is allowed." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt new file mode 100644 index 00000000000..61d124a2a43 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.kt @@ -0,0 +1,13 @@ +package org.openapijsonschematools.client.schemas.validation + +class PathToSchemasMap : LinkedHashMap, LinkedHashMap, Nothing?>>() { + fun update(other: PathToSchemasMap) { + for ((pathToItem, otherSchemas) in other) { + if (containsKey(pathToItem)) { + get(pathToItem)!!.putAll(otherSchemas) + } else { + put(pathToItem, otherSchemas) + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt new file mode 100644 index 00000000000..1ba9fd8396b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternPropertiesValidator.kt @@ -0,0 +1,15 @@ +package org.openapijsonschematools.client.schemas.validation + +class PatternPropertiesValidator : KeywordValidator { + override fun validate( + data: ValidationData + ): PathToSchemasMap? + { + if (data.schema.patternProperties == null) { + return null + } + return if (data.arg !is Map<*, *>) { + null + } else data.patternPropertiesPathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt new file mode 100644 index 00000000000..085c21a2943 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PatternValidator.kt @@ -0,0 +1,21 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.util.regex.Pattern + +class PatternValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val pattern: Pattern = data.schema.pattern ?: return null + if (data.arg !is String) { + return null + } + if (!pattern.matcher(data.arg).find()) { + throw ValidationException("Invalid value ${data.arg} did not find a match for pattern $pattern") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt new file mode 100644 index 00000000000..6435a86bfe1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PrefixItemsValidator.kt @@ -0,0 +1,35 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.math.min + +class PrefixItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val prefixItems: List>> = data.schema.prefixItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val maxIndex: Int = min(data.arg.size, prefixItems.size) + for (i in 0 until maxIndex) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val itemsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(prefixItems[i]) + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt new file mode 100644 index 00000000000..93cb2bcb320 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidator.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class PropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val properties: Map>> = data.schema.properties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, propClass) in properties.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val propValue: Any? = data.arg[propName] + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(propName) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val propSchema = JsonSchemaFactory.getInstance(propClass) + if (propValidationMetadata.validationRanEarlier(propSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt new file mode 100644 index 00000000000..3e41a82ebb8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/PropertyNamesValidator.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class PropertyNamesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val propertyNames: Class> = data.schema.propertyNames ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames) + for (objKey in data.arg.keys) { + if (objKey is String) { + val propPathToItem: List = data.validationMetadata.pathToItem + objKey + val keyValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + JsonSchema.validate(propertyNamesSchema, objKey, keyValidationMetadata) + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt new file mode 100644 index 00000000000..d2ac79c82d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidator.kt @@ -0,0 +1,32 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class RequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val required: Set = data.schema.required ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val missingRequiredProperties: MutableSet = HashSet(required) + for (key in data.arg.keys) { + if (key is String) { + missingRequiredProperties.remove(key) + } + } + if (missingRequiredProperties.isNotEmpty()) { + val missingReqProps: List = missingRequiredProperties.toList().sorted() + var pluralChar = "" + if (missingRequiredProperties.size > 1) { + pluralChar = "s" + } + throw ValidationException( + data.schema.javaClass.simpleName + " is missing " + missingRequiredProperties.size + " required argument" + pluralChar + ": " + missingReqProps + ) + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt new file mode 100644 index 00000000000..c23532466f2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringEnumValidator.kt @@ -0,0 +1,9 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface StringEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): String +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt new file mode 100644 index 00000000000..b9622585d38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringSchemaValidator.kt @@ -0,0 +1,12 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +interface StringSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String + + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt new file mode 100644 index 00000000000..4e2ddeaf4e0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/StringValueMethod.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.schemas.validation + +interface StringValueMethod { + fun value(): String +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt new file mode 100644 index 00000000000..d63a1a36d18 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ThenValidator.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class ThenValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val then: Class> = data.schema.then ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (ifPathToSchemas.isEmpty()) { + // if validation is false + return null + } + val thenSchema = JsonSchemaFactory.getInstance(then) + val pathToSchemas = PathToSchemasMap() + val thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an then error? + pathToSchemas.update(ifPathToSchemas) + pathToSchemas.update(thenPathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt new file mode 100644 index 00000000000..635d85eb28c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidator.kt @@ -0,0 +1,51 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class TypeValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.type == null) { + return null + } + val argClass = when (data.arg) { + null -> { + Void::class.java + } + is List<*> -> { + List::class.java + } + + is Map<*, *> -> { + Map::class.java + } + + is Boolean -> { + Boolean::class.java + } + + is Int -> { + Int::class.java + } + is Long -> { + Long::class.java + } + is Double -> { + Double::class.java + } + is Float -> { + Float::class.java + } + + else -> { + data.arg.javaClass + } + } + if (!data.schema.type.contains(argClass)) { + throw ValidationException("invalid type") + } + return null + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt new file mode 100644 index 00000000000..4ac1a823821 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedItemsValidator.kt @@ -0,0 +1,41 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UnevaluatedItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedItems: Class> = data.schema.unevaluatedItems ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems) + for (i in minIndex until data.arg.size) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + if (knownPathToSchemas.containsKey(itemPathToItem)) { + continue + } + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt new file mode 100644 index 00000000000..f78940fc822 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnevaluatedPropertiesValidator.kt @@ -0,0 +1,36 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UnevaluatedPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedProperties: Class> = data.schema.unevaluatedProperties ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties) + for ((key, value) in data.arg.entries) { + if (key !is String) { + throw ValidationException("Map keys must be strings") + } + val propPathToItem: List = data.validationMetadata.pathToItem + key + if (knownPathToSchemas.containsKey(propPathToItem)) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt new file mode 100644 index 00000000000..2c2f41591b0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UniqueItemsValidator.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.exceptions.ValidationException + +class UniqueItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val uniqueItems: Boolean = data.schema.uniqueItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (!uniqueItems) { + return null + } + val seenItems: MutableSet = HashSet() + for (item in data.arg) { + val startingSeenItemsSize = seenItems.size + seenItems.add(item) + if (seenItems.size == startingSeenItemsSize) { + throw ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true") + } + } + return null + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt new file mode 100644 index 00000000000..3797fa632b2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/UnsetAnyTypeJsonSchema.kt @@ -0,0 +1,336 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class UnsetAnyTypeJsonSchema { + sealed interface UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + data class UnsetAnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: UnsetAnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnsetAnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt new file mode 100644 index 00000000000..4629847ee87 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationData.kt @@ -0,0 +1,11 @@ +package org.openapijsonschematools.client.schemas.validation + +data class ValidationData( + val schema: JsonSchema<*>, + val arg: Any?, + val validationMetadata: ValidationMetadata, + val containsPathToSchemas: List? = null, + val patternPropertiesPathToSchemas: PathToSchemasMap? = null, + val ifPathToSchemas: PathToSchemasMap? = null, + val knownPathToSchemas: PathToSchemasMap? = null +) \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt new file mode 100644 index 00000000000..39ccadbdde6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/schemas/validation/ValidationMetadata.kt @@ -0,0 +1,18 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.SchemaConfiguration + +data class ValidationMetadata( + val pathToItem: List, + val configuration: SchemaConfiguration, + val validatedPathToSchemas: PathToSchemasMap, + val seenClasses: Set> +) { + fun validationRanEarlier(schema: JsonSchema<*>): Boolean { + val validatedSchemas: Map, Nothing?>? = validatedPathToSchemas[pathToItem] + if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { + return true + } + return seenClasses.contains(schema.javaClass) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt new file mode 100644 index 00000000000..6b3d3c867c2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/RootServer0.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +import org.openapijsonschematools.client.servers.ServerWithoutVariables; + +class RootServer0 : ServerWithoutVariables("https://someserver.com/v1") { +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt new file mode 100644 index 00000000000..916d6a489bf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/Server.kt @@ -0,0 +1,5 @@ +package org.openapijsonschematools.client.servers; + +interface Server { + fun url(): String +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt new file mode 100644 index 00000000000..65dcd7942f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerProvider.kt @@ -0,0 +1,6 @@ +package org.openapijsonschematools.client.servers; + +interface ServerProvider { + fun getServer(serverIndex: T): Server +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt new file mode 100644 index 00000000000..7cf85cd8ccf --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithVariables.kt @@ -0,0 +1,20 @@ +package org.openapijsonschematools.client.servers + +abstract class ServerWithVariables> protected constructor(url: String, variables: T) : + Server { + val url: String + val variables: T + + init { + var url = url + this.variables = variables + for ((key, value) in variables) { + url = url.replace("{$key}", value) + } + this.url = url + } + + override fun url(): String { + return url + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt new file mode 100644 index 00000000000..6267cc468f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/main/kotlin/org/openapijsonschematools/client/servers/ServerWithoutVariables.kt @@ -0,0 +1,8 @@ +package org.openapijsonschematools.client.servers; + +abstract class ServerWithoutVariables protected constructor(val url: String) : Server { + override fun url(): String { + return url + } +} + diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt new file mode 100644 index 00000000000..6f088da48e8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ASchemaGivenForPrefixitemsTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ASchemaGivenForPrefixitemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testCorrectTypesPasses() { + // correct types + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .add(1) + + .add("foo") + + .build(), + configuration + ) + } + + @Test + fun testArrayWithAdditionalItemsPasses() { + // array with additional items + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .add(1) + + .add("foo") + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testJavascriptPseudoArrayIsValidPasses() { + // JavaScript pseudo-array is valid + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + mapOf( + Pair( + "0", + "invalid" + ), + Pair( + "1", + "valid" + ), + Pair( + "length", + 2 + ) + ), + configuration + ) + } + + @Test + fun testEmptyArrayPasses() { + // empty array + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .build(), + configuration + ) + } + + @Test + fun testWrongTypesFails() { + // wrong types + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testIncompleteArrayOfItemsPasses() { + // incomplete array of items + val schema = ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitems1.getInstance() + schema.validate( + ASchemaGivenForPrefixitems.ASchemaGivenForPrefixitemsListBuilder() + .add(1) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt new file mode 100644 index 00000000000..b631f7ea5c4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalItemsAreAllowedByDefaultTest.kt @@ -0,0 +1,31 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalItemsAreAllowedByDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOnlyTheFirstItemIsValidatedPasses() { + // only the first item is validated + val schema = AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefault1.getInstance() + schema.validate( + AdditionalItemsAreAllowedByDefault.AdditionalItemsAreAllowedByDefaultListBuilder() + .add(1) + + .add("foo") + + .add(false) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt new file mode 100644 index 00000000000..0a6f7f758b3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefaultTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesAreAllowedByDefaultTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAdditionalPropertiesAreAllowedPasses() { + // additional properties are allowed + val schema = AdditionalpropertiesAreAllowedByDefault.AdditionalpropertiesAreAllowedByDefault1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt new file mode 100644 index 00000000000..e4b32602f7e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItselfTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesCanExistByItselfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt new file mode 100644 index 00000000000..a0cbb3098bb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesDoesNotLookInApplicatorsTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesDoesNotLookInApplicatorsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertiesDefinedInAllofAreNotExaminedFails() { + // properties defined in allOf are not examined + val schema = AdditionalpropertiesDoesNotLookInApplicators.AdditionalpropertiesDoesNotLookInApplicators1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + true + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..1889c430890 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuesPasses() { + // allows null values + val schema = AdditionalpropertiesWithNullValuedInstanceProperties.AdditionalpropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt new file mode 100644 index 00000000000..946a077cb7a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesWithSchemaTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AdditionalpropertiesWithSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNoAdditionalPropertiesIsValidPasses() { + // no additional properties is valid + val schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalValidPropertyIsValidPasses() { + // an additional valid property is valid + val schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + true + ) + ), + configuration + ) + } + + @Test + fun testAnAdditionalInvalidPropertyIsInvalidFails() { + // an additional invalid property is invalid + val schema = AdditionalpropertiesWithSchema.AdditionalpropertiesWithSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + 12 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt new file mode 100644 index 00000000000..5703d263e49 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneofTest.kt @@ -0,0 +1,122 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofCombinedWithAnyofOneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllofFalseAnyofFalseOneofTrueFails() { + // allOf: false, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 5, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofFalseFails() { + // allOf: false, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testAllofFalseAnyofTrueOneofTrueFails() { + // allOf: false, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 15, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofFalseFails() { + // allOf: true, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 2, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofTruePasses() { + // allOf: true, anyOf: true, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + schema.validate( + 30, + configuration + ) + } + + @Test + fun testAllofFalseAnyofFalseOneofFalseFails() { + // allOf: false, anyOf: false, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofFalseOneofTrueFails() { + // allOf: true, anyOf: false, oneOf: true + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 10, + configuration + ) + } + ) + } + + @Test + fun testAllofTrueAnyofTrueOneofFalseFails() { + // allOf: true, anyOf: true, oneOf: false + val schema = AllofCombinedWithAnyofOneof.AllofCombinedWithAnyofOneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 6, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt new file mode 100644 index 00000000000..ff6e7d933dd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofSimpleTypesTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofSimpleTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchOneFails() { + // mismatch one + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofSimpleTypes.AllofSimpleTypes1.getInstance() + schema.validate( + 25, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt new file mode 100644 index 00000000000..c2af359082b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchSecondFails() { + // mismatch second + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongTypeFails() { + // wrong type + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstFails() { + // mismatch first + val schema = Allof.Allof1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAllofPasses() { + // allOf + val schema = Allof.Allof1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..f4b4b2af3fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchemaTest.kt @@ -0,0 +1,125 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchFirstAllofFails() { + // mismatch first allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + null + ) + ), + configuration + ) + } + + @Test + fun testMismatchBothFails() { + // mismatch both + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMismatchSecondAllofFails() { + // mismatch second allOf + val schema = AllofWithBaseSchema.AllofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..081371231ec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchemaTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithOneEmptySchema.AllofWithOneEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt new file mode 100644 index 00000000000..5f40ab6e1ce --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheFirstEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheFirstEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheFirstEmptySchema.AllofWithTheFirstEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt new file mode 100644 index 00000000000..1669c0495aa --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTheLastEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTheLastEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AllofWithTheLastEmptySchema.AllofWithTheLastEmptySchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt new file mode 100644 index 00000000000..e9e9a86e68e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AllofWithTwoEmptySchemasTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AllofWithTwoEmptySchemasTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyDataIsValidPasses() { + // any data is valid + val schema = AllofWithTwoEmptySchemas.AllofWithTwoEmptySchemas1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt new file mode 100644 index 00000000000..997c742aa1f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofComplexTypesTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondAnyofValidComplexPasses() { + // second anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothAnyofValidComplexPasses() { + // both anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testFirstAnyofValidComplexPasses() { + // first anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherAnyofValidComplexFails() { + // neither anyOf valid (complex) + val schema = AnyofComplexTypes.AnyofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt new file mode 100644 index 00000000000..a525d7d0312 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothAnyofValidPasses() { + // both anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 3, + configuration + ) + } + + @Test + fun testNeitherAnyofValidFails() { + // neither anyOf valid + val schema = Anyof.Anyof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testFirstAnyofValidPasses() { + // first anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testSecondAnyofValidPasses() { + // second anyOf valid + val schema = Anyof.Anyof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..76ed26e5272 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneAnyofValidPasses() { + // one anyOf valid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothAnyofInvalidFails() { + // both anyOf invalid + val schema = AnyofWithBaseSchema.AnyofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt new file mode 100644 index 00000000000..9a0ca10b5cd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/AnyofWithOneEmptySchemaTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class AnyofWithOneEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsValidPasses() { + // number is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testStringIsValidPasses() { + // string is valid + val schema = AnyofWithOneEmptySchema.AnyofWithOneEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt new file mode 100644 index 00000000000..7e4c8375edc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ArrayTypeMatchesArraysTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ArrayTypeMatchesArraysTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testABooleanIsNotAnArrayFails() { + // a boolean is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnArrayFails() { + // a float is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsAnArrayPasses() { + // an array is an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testNullIsNotAnArrayFails() { + // null is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnArrayFails() { + // a string is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnArrayFails() { + // an integer is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAnArrayFails() { + // an object is not an array + val schema = ArrayTypeMatchesArrays.ArrayTypeMatchesArrays1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt new file mode 100644 index 00000000000..c9fb755da34 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BooleanTypeMatchesBooleansTest.kt @@ -0,0 +1,148 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BooleanTypeMatchesBooleansTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsNotABooleanFails() { + // a float is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotABooleanFails() { + // a string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testFalseIsABooleanPasses() { + // false is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testTrueIsABooleanPasses() { + // true is a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testAnObjectIsNotABooleanFails() { + // an object is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotABooleanFails() { + // an array is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotABooleanFails() { + // null is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotABooleanFails() { + // an integer is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testZeroIsNotABooleanFails() { + // zero is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotABooleanFails() { + // an empty string is not a boolean + val schema = BooleanTypeMatchesBooleans.BooleanTypeMatchesBooleans1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt new file mode 100644 index 00000000000..89bd4860dd8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByIntTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByIntTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIntByIntFailFails() { + // int by int fail + val schema = ByInt.ByInt1.getInstance() + assertFailsWith( + block = { + schema.validate( + 7, + configuration + ) + } + ) + } + + @Test + fun testIntByIntPasses() { + // int by int + val schema = ByInt.ByInt1.getInstance() + schema.validate( + 10, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ByInt.ByInt1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt new file mode 100644 index 00000000000..a6fd5fe3f47 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ByNumberTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ByNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test35IsNotMultipleOf15Fails() { + // 35 is not multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 35, + configuration + ) + } + ) + } + + @Test + fun test45IsMultipleOf15Passes() { + // 4.5 is multiple of 1.5 + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 4.5, + configuration + ) + } + + @Test + fun testZeroIsMultipleOfAnythingPasses() { + // zero is multiple of anything + val schema = ByNumber.ByNumber1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt new file mode 100644 index 00000000000..f6fc84b9514 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/BySmallNumberTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class BySmallNumberTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test000751IsNotMultipleOf00001Fails() { + // 0.00751 is not multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.00751, + configuration + ) + } + ) + } + + @Test + fun test00075IsMultipleOf00001Passes() { + // 0.0075 is multiple of 0.0001 + val schema = BySmallNumber.BySmallNumber1.getInstance() + schema.validate( + 0.0075, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt new file mode 100644 index 00000000000..6b2830093e7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ConstNulCharactersInStringsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ConstNulCharactersInStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchStringWithNulPasses() { + // match string with nul + val schema = ConstNulCharactersInStrings.ConstNulCharactersInStrings1.getInstance() + schema.validate( + "hello\u0000there", + configuration + ) + } + + @Test + fun testDoNotMatchStringLackingNulFails() { + // do not match string lacking nul + val schema = ConstNulCharactersInStrings.ConstNulCharactersInStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + "hellothere", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt new file mode 100644 index 00000000000..bddb82e3b65 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsKeywordValidationTest.kt @@ -0,0 +1,101 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ContainsKeywordValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testArrayWithTwoItemsMatchingSchema56IsValidPasses() { + // array with two items matching schema (5, 6) is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + listOf( + 3, + 4, + 5, + 6 + ), + configuration + ) + } + + @Test + fun testNotArrayIsValidPasses() { + // not array is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testArrayWithItemMatchingSchema5IsValidPasses() { + // array with item matching schema (5) is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + listOf( + 3, + 4, + 5 + ), + configuration + ) + } + + @Test + fun testArrayWithItemMatchingSchema6IsValidPasses() { + // array with item matching schema (6) is valid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + schema.validate( + listOf( + 3, + 4, + 6 + ), + configuration + ) + } + + @Test + fun testArrayWithoutItemsMatchingSchemaIsInvalidFails() { + // array without items matching schema is invalid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 2, + 3, + 4 + ), + configuration + ) + } + ) + } + + @Test + fun testEmptyArrayIsInvalidFails() { + // empty array is invalid + val schema = ContainsKeywordValidation.ContainsKeywordValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..6a0b9ba9e20 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ContainsWithNullInstanceElementsTest.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ContainsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullItemsPasses() { + // allows null items + val schema = ContainsWithNullInstanceElements.ContainsWithNullInstanceElements1.getInstance() + schema.validate( + listOf( + null + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt new file mode 100644 index 00000000000..562bbad107a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DateFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidDateStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid date string is only an annotation by default + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + "06/19/1963", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DateFormat.DateFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt new file mode 100644 index 00000000000..cd94c25bf62 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DateTimeFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DateTimeFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testInvalidDateTimeStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid date-time string is only an annotation by default + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + "1990-02-31T15:59:60.123-08:00", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DateTimeFormat.DateTimeFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..89555d37407 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependenciesWithEscapedCharactersTest.kt @@ -0,0 +1,107 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DependentSchemasDependenciesWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testQuotedQuoteInvalidUnderDependentSchemaFails() { + // quoted quote invalid under dependent schema + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo'bar", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testQuotedTabInvalidUnderDependentSchemaFails() { + // quoted tab invalid under dependent schema + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\tbar", + 1 + ), + Pair( + "a", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testQuotedTabPasses() { + // quoted tab + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\tbar", + 1 + ), + Pair( + "a", + 2 + ), + Pair( + "b", + 3 + ), + Pair( + "c", + 4 + ) + ), + configuration + ) + } + + @Test + fun testQuotedQuoteFails() { + // quoted quote + val schema = DependentSchemasDependenciesWithEscapedCharacters.DependentSchemasDependenciesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo'bar", + mapOf( + Pair( + "foo\"bar", + 1 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt new file mode 100644 index 00000000000..025f525c434 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasDependentSubschemaIncompatibleWithRootTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DependentSchemasDependentSubschemaIncompatibleWithRootTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesRootFails() { + // matches root + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchesDependencyPasses() { + // matches dependency + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 1 + ) + ), + configuration + ) + } + + @Test + fun testNoDependencyPasses() { + // no dependency + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + schema.validate( + mapOf( + Pair( + "baz", + 1 + ) + ), + configuration + ) + } + + @Test + fun testMatchesBothFails() { + // matches both + val schema = DependentSchemasDependentSubschemaIncompatibleWithRoot.DependentSchemasDependentSubschemaIncompatibleWithRoot1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt new file mode 100644 index 00000000000..d36a5ae6a8f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DependentSchemasSingleDependencyTest.kt @@ -0,0 +1,149 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DependentSchemasSingleDependencyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWrongTypeFails() { + // wrong type + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNoDependencyPasses() { + // no dependency + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + listOf( + "bar" + ), + configuration + ) + } + + @Test + fun testWrongTypeBothFails() { + // wrong type both + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "quux" + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testWrongTypeOtherFails() { + // wrong type other + val schema = DependentSchemasSingleDependency.DependentSchemasSingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt new file mode 100644 index 00000000000..828493e7967 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/DurationFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class DurationFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidDurationStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid duration string is only an annotation by default + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + "PT1D", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = DurationFormat.DurationFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt new file mode 100644 index 00000000000..3da34bea4dd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmailFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EmailFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidEmailStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid email string is only an annotation by default + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + "2962", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = EmailFormat.EmailFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt new file mode 100644 index 00000000000..7099cc2f52b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EmptyDependentsTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EmptyDependentsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testEmptyObjectPasses() { + // empty object + val schema = EmptyDependents.EmptyDependents1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testNonObjectIsValidPasses() { + // non-object is valid + val schema = EmptyDependents.EmptyDependents1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testObjectWithOnePropertyPasses() { + // object with one property + val schema = EmptyDependents.EmptyDependents1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt new file mode 100644 index 00000000000..c398f777e9a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith0DoesNotMatchFalseTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith0DoesNotMatchFalseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsValidPasses() { + // float zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0.0, + configuration + ) + } + + @Test + fun testFalseIsInvalidFails() { + // false is invalid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testIntegerZeroIsValidPasses() { + // integer zero is valid + val schema = EnumWith0DoesNotMatchFalse.EnumWith0DoesNotMatchFalse1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt new file mode 100644 index 00000000000..8ff4f796ea8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWith1DoesNotMatchTrueTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWith1DoesNotMatchTrueTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTrueIsInvalidFails() { + // true is invalid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFloatOneIsValidPasses() { + // float one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testIntegerOneIsValidPasses() { + // integer one is valid + val schema = EnumWith1DoesNotMatchTrue.EnumWith1DoesNotMatchTrue1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..66bd002ada2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithEscapedCharactersTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnotherStringIsInvalidFails() { + // another string is invalid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testMember2IsValidPasses() { + // member 2 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\rbar", + configuration + ) + } + + @Test + fun testMember1IsValidPasses() { + // member 1 is valid + val schema = EnumWithEscapedCharacters.EnumWithEscapedCharacters1.getInstance() + schema.validate( + "foo\nbar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt new file mode 100644 index 00000000000..540c60f5577 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithFalseDoesNotMatch0Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithFalseDoesNotMatch0Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatZeroIsInvalidFails() { + // float zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.0, + configuration + ) + } + ) + } + + @Test + fun testFalseIsValidPasses() { + // false is valid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testIntegerZeroIsInvalidFails() { + // integer zero is invalid + val schema = EnumWithFalseDoesNotMatch0.EnumWithFalseDoesNotMatch01.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt new file mode 100644 index 00000000000..4f5ca3b42fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumWithTrueDoesNotMatch1Test.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumWithTrueDoesNotMatch1Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFloatOneIsInvalidFails() { + // float one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0, + configuration + ) + } + ) + } + + @Test + fun testIntegerOneIsInvalidFails() { + // integer one is invalid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testTrueIsValidPasses() { + // true is valid + val schema = EnumWithTrueDoesNotMatch1.EnumWithTrueDoesNotMatch11.getInstance() + schema.validate( + true, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt new file mode 100644 index 00000000000..d98a079ce00 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/EnumsInPropertiesTest.kt @@ -0,0 +1,128 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class EnumsInPropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWrongBarValueFails() { + // wrong bar value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bart" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWrongFooValueFails() { + // wrong foo value + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foot" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMissingAllPropertiesIsInvalidFails() { + // missing all properties is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testBothPropertiesAreValidPasses() { + // both properties are valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingOptionalPropertyIsValidPasses() { + // missing optional property is valid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testMissingRequiredPropertyIsInvalidFails() { + // missing required property is invalid + val schema = EnumsInProperties.EnumsInProperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt new file mode 100644 index 00000000000..e4c7fcaa212 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusivemaximumValidationTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ExclusivemaximumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBelowTheExclusivemaximumIsValidPasses() { + // below the exclusiveMaximum is valid + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + schema.validate( + 2.2, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testAboveTheExclusivemaximumIsInvalidFails() { + // above the exclusiveMaximum is invalid + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.5, + configuration + ) + } + ) + } + + @Test + fun testBoundaryPointIsInvalidFails() { + // boundary point is invalid + val schema = ExclusivemaximumValidation.ExclusivemaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.0, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt new file mode 100644 index 00000000000..4d7b296f0d4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ExclusiveminimumValidationTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ExclusiveminimumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBelowTheExclusiveminimumIsInvalidFails() { + // below the exclusiveMinimum is invalid + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.6, + configuration + ) + } + ) + } + + @Test + fun testAboveTheExclusiveminimumIsValidPasses() { + // above the exclusiveMinimum is valid + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + schema.validate( + 1.2, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testBoundaryPointIsInvalidFails() { + // boundary point is invalid + val schema = ExclusiveminimumValidation.ExclusiveminimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt new file mode 100644 index 00000000000..427cf255abb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/FloatDivisionInfTest.kt @@ -0,0 +1,28 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class FloatDivisionInfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAlwaysInvalidButNaiveImplementationsMayRaiseAnOverflowErrorFails() { + // always invalid, but naive implementations may raise an overflow error + val schema = FloatDivisionInf.FloatDivisionInf1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.0E308, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt new file mode 100644 index 00000000000..79c52a38bb6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ForbiddenPropertyTest.kt @@ -0,0 +1,56 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ForbiddenPropertyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyPresentFails() { + // property present + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyAbsentPasses() { + // property absent + val schema = ForbiddenProperty.ForbiddenProperty1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 1 + ), + Pair( + "baz", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt new file mode 100644 index 00000000000..5129b597c93 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/HostnameFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class HostnameFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidHostnameStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid hostname string is only an annotation by default + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + "-a-host-name-that-starts-with--", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = HostnameFormat.HostnameFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt new file mode 100644 index 00000000000..d50093b6ec5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnEmailFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IdnEmailFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidIdnEmailStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid idn-email string is only an annotation by default + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + "2962", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IdnEmailFormat.IdnEmailFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt new file mode 100644 index 00000000000..9e54690f2c7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IdnHostnameFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IdnHostnameFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidIdnHostnameStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid idn-hostname string is only an annotation by default + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + "〮실례.테스트", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IdnHostnameFormat.IdnHostnameFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt new file mode 100644 index 00000000000..5c6556adfe5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndElseWithoutThenTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IfAndElseWithoutThenTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenIfTestPassesPasses() { + // valid when if test passes + val schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testValidThroughElsePasses() { + // valid through else + val schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance() + schema.validate( + 4, + configuration + ) + } + + @Test + fun testInvalidThroughElseFails() { + // invalid through else + val schema = IfAndElseWithoutThen.IfAndElseWithoutThen1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt new file mode 100644 index 00000000000..75d801c5fa1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAndThenWithoutElseTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IfAndThenWithoutElseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidThroughThenPasses() { + // valid through then + val schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testInvalidThroughThenFails() { + // invalid through then + val schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance() + assertFailsWith( + block = { + schema.validate( + -100, + configuration + ) + } + ) + } + + @Test + fun testValidWhenIfTestFailsPasses() { + // valid when if test fails + val schema = IfAndThenWithoutElse.IfAndThenWithoutElse1.getInstance() + schema.validate( + 3, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt new file mode 100644 index 00000000000..9b5ecd87c6d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IfAppearsAtTheEndWhenSerializedKeywordProcessingSequenceTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testInvalidRedirectsToElseAndFailsFails() { + // invalid redirects to else and fails + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + assertFailsWith( + block = { + schema.validate( + "invalid", + configuration + ) + } + ) + } + + @Test + fun testYesRedirectsToThenAndPassesPasses() { + // yes redirects to then and passes + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + schema.validate( + "yes", + configuration + ) + } + + @Test + fun testOtherRedirectsToElseAndPassesPasses() { + // other redirects to else and passes + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + schema.validate( + "other", + configuration + ) + } + + @Test + fun testNoRedirectsToThenAndFailsFails() { + // no redirects to then and fails + val schema = IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence.IfAppearsAtTheEndWhenSerializedKeywordProcessingSequence1.getInstance() + assertFailsWith( + block = { + schema.validate( + "no", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt new file mode 100644 index 00000000000..67c61cf0569 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreElseWithoutIfTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IgnoreElseWithoutIfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenInvalidAgainstLoneElsePasses() { + // valid when invalid against lone else + val schema = IgnoreElseWithoutIf.IgnoreElseWithoutIf1.getInstance() + schema.validate( + "hello", + configuration + ) + } + + @Test + fun testValidWhenValidAgainstLoneElsePasses() { + // valid when valid against lone else + val schema = IgnoreElseWithoutIf.IgnoreElseWithoutIf1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt new file mode 100644 index 00000000000..c7b4402eb56 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreIfWithoutThenOrElseTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IgnoreIfWithoutThenOrElseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenInvalidAgainstLoneIfPasses() { + // valid when invalid against lone if + val schema = IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1.getInstance() + schema.validate( + "hello", + configuration + ) + } + + @Test + fun testValidWhenValidAgainstLoneIfPasses() { + // valid when valid against lone if + val schema = IgnoreIfWithoutThenOrElse.IgnoreIfWithoutThenOrElse1.getInstance() + schema.validate( + 0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt new file mode 100644 index 00000000000..d6d6639d068 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IgnoreThenWithoutIfTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IgnoreThenWithoutIfTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidWhenValidAgainstLoneThenPasses() { + // valid when valid against lone then + val schema = IgnoreThenWithoutIf.IgnoreThenWithoutIf1.getInstance() + schema.validate( + 0, + configuration + ) + } + + @Test + fun testValidWhenInvalidAgainstLoneThenPasses() { + // valid when invalid against lone then + val schema = IgnoreThenWithoutIf.IgnoreThenWithoutIf1.getInstance() + schema.validate( + "hello", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt new file mode 100644 index 00000000000..5acb5daa6ce --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IntegerTypeMatchesIntegersTest.kt @@ -0,0 +1,134 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IntegerTypeMatchesIntegersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsNotAnIntegerFails() { + // an object is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotAnIntegerFails() { + // an array is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnIntegerFails() { + // null is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsAnIntegerPasses() { + // a float with zero fractional part is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testABooleanIsNotAnIntegerFails() { + // a boolean is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsStillNotAnIntegerEvenIfItLooksLikeOneFails() { + // a string is still not an integer, even if it looks like one + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnIntegerFails() { + // a string is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsAnIntegerPasses() { + // an integer is an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAFloatIsNotAnIntegerFails() { + // a float is not an integer + val schema = IntegerTypeMatchesIntegers.IntegerTypeMatchesIntegers1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt new file mode 100644 index 00000000000..6b5989717f5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv4FormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv4FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidIpv4StringIsOnlyAnAnnotationByDefaultPasses() { + // invalid ipv4 string is only an annotation by default + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + "127.0.0.0.1", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv4Format.Ipv4Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt new file mode 100644 index 00000000000..fc03ee62466 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Ipv6FormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Ipv6FormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidIpv6StringIsOnlyAnAnnotationByDefaultPasses() { + // invalid ipv6 string is only an annotation by default + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + "12345::", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = Ipv6Format.Ipv6Format1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt new file mode 100644 index 00000000000..23a886305dc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IriFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidIriStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid iri string is only an annotation by default + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IriFormat.IriFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt new file mode 100644 index 00000000000..dd42e1bee35 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/IriReferenceFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class IriReferenceFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidIriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid iri-reference string is only an annotation by default + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + "\\\\WINDOWS\\filëßåré", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = IriReferenceFormat.IriReferenceFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt new file mode 100644 index 00000000000..cdfd1262deb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsContainsTest.kt @@ -0,0 +1,82 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ItemsContainsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesItemsDoesNotMatchContainsFails() { + // matches items, does not match contains + val schema = ItemsContains.ItemsContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 2, + 4, + 8 + ), + configuration + ) + } + ) + } + + @Test + fun testMatchesNeitherItemsNorContainsFails() { + // matches neither items nor contains + val schema = ItemsContains.ItemsContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 5 + ), + configuration + ) + } + ) + } + + @Test + fun testDoesNotMatchItemsMatchesContainsFails() { + // does not match items, matches contains + val schema = ItemsContains.ItemsContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 3, + 6, + 9 + ), + configuration + ) + } + ) + } + + @Test + fun testMatchesBothItemsAndContainsPasses() { + // matches both items and contains + val schema = ItemsContains.ItemsContains1.getInstance() + schema.validate( + ItemsContains.ItemsContainsListBuilder() + .add(6) + + .add(12) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt new file mode 100644 index 00000000000..f4afc8468bd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsDoesNotLookInApplicatorsValidCaseTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ItemsDoesNotLookInApplicatorsValidCaseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPrefixitemsInAllofDoesNotConstrainItemsValidCasePasses() { + // prefixItems in allOf does not constrain items, valid case + val schema = ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1.getInstance() + schema.validate( + ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCaseListBuilder() + .add(5) + + .add(5) + + .build(), + configuration + ) + } + + @Test + fun testPrefixitemsInAllofDoesNotConstrainItemsInvalidCaseFails() { + // prefixItems in allOf does not constrain items, invalid case + val schema = ItemsDoesNotLookInApplicatorsValidCase.ItemsDoesNotLookInApplicatorsValidCase1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 3, + 5 + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..ef4335fbc2e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ItemsWithNullInstanceElementsTest.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ItemsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullElementsPasses() { + // allows null elements + val schema = ItemsWithNullInstanceElements.ItemsWithNullInstanceElements1.getInstance() + schema.validate( + ItemsWithNullInstanceElements.ItemsWithNullInstanceElementsListBuilder() + .add(null) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt new file mode 100644 index 00000000000..8e1c66417ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/JsonPointerFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class JsonPointerFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testInvalidJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid json-pointer string is only an annotation by default + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + "/foo/bar~", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = JsonPointerFormat.JsonPointerFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt new file mode 100644 index 00000000000..3c089662754 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxcontainsWithoutContainsIsIgnoredTest.kt @@ -0,0 +1,39 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxcontainsWithoutContainsIsIgnoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTwoItemsStillValidAgainstLoneMaxcontainsPasses() { + // two items still valid against lone maxContains + val schema = MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testOneItemValidAgainstLoneMaxcontainsPasses() { + // one item valid against lone maxContains + val schema = MaxcontainsWithoutContainsIsIgnored.MaxcontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt new file mode 100644 index 00000000000..d6e53bea2b0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidation.MaximumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3.5, + configuration + ) + } + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 3.0, + configuration + ) + } + + @Test + fun testBelowTheMaximumIsValidPasses() { + // below the maximum is valid + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MaximumValidation.MaximumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt new file mode 100644 index 00000000000..f486b09d617 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaximumValidationWithUnsignedIntegerTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaximumValidationWithUnsignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAboveTheMaximumIsInvalidFails() { + // above the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + 300.5, + configuration + ) + } + ) + } + + @Test + fun testBelowTheMaximumIsInvalidPasses() { + // below the maximum is invalid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 299.97, + configuration + ) + } + + @Test + fun testBoundaryPointIntegerIsValidPasses() { + // boundary point integer is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300, + configuration + ) + } + + @Test + fun testBoundaryPointFloatIsValidPasses() { + // boundary point float is valid + val schema = MaximumValidationWithUnsignedInteger.MaximumValidationWithUnsignedInteger1.getInstance() + schema.validate( + 300.0, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt new file mode 100644 index 00000000000..01c61a00377 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxitemsValidationTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MaxitemsValidation.MaxitemsValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt new file mode 100644 index 00000000000..dba10dc74cc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxlengthValidationTest.kt @@ -0,0 +1,68 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "f", + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + 100, + configuration + ) + } + + @Test + fun testTwoSupplementaryUnicodeCodePointsIsLongEnoughPasses() { + // two supplementary Unicode code points is long enough + val schema = MaxlengthValidation.MaxlengthValidation1.getInstance() + schema.validate( + "💩💩", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt new file mode 100644 index 00000000000..8c397df7deb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/Maxproperties0MeansTheObjectIsEmptyTest.kt @@ -0,0 +1,44 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class Maxproperties0MeansTheObjectIsEmptyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOnePropertyIsInvalidFails() { + // one property is invalid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoPropertiesIsValidPasses() { + // no properties is valid + val schema = Maxproperties0MeansTheObjectIsEmpty.Maxproperties0MeansTheObjectIsEmpty1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt new file mode 100644 index 00000000000..25fe6859ed0 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MaxpropertiesValidationTest.kt @@ -0,0 +1,109 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MaxpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testShorterIsValidPasses() { + // shorter is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testTooLongIsInvalidFails() { + // too long is invalid + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MaxpropertiesValidation.MaxpropertiesValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt new file mode 100644 index 00000000000..a9586fae97f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MincontainsWithoutContainsIsIgnoredTest.kt @@ -0,0 +1,37 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MincontainsWithoutContainsIsIgnoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOneItemValidAgainstLoneMincontainsPasses() { + // one item valid against lone minContains + val schema = MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testZeroItemsStillValidAgainstLoneMincontainsPasses() { + // zero items still valid against lone minContains + val schema = MincontainsWithoutContainsIsIgnored.MincontainsWithoutContainsIsIgnored1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt new file mode 100644 index 00000000000..3424b61c67d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testBelowTheMinimumIsInvalidFails() { + // below the minimum is invalid + val schema = MinimumValidation.MinimumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0.6, + configuration + ) + } + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testAboveTheMinimumIsValidPasses() { + // above the minimum is valid + val schema = MinimumValidation.MinimumValidation1.getInstance() + schema.validate( + 2.6, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt new file mode 100644 index 00000000000..a137255840d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinimumValidationWithSignedIntegerTest.kt @@ -0,0 +1,92 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinimumValidationWithSignedIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBoundaryPointWithFloatIsValidPasses() { + // boundary point with float is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2.0, + configuration + ) + } + + @Test + fun testBoundaryPointIsValidPasses() { + // boundary point is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -2, + configuration + ) + } + + @Test + fun testIntBelowTheMinimumIsInvalidFails() { + // int below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -3, + configuration + ) + } + ) + } + + @Test + fun testPositiveAboveTheMinimumIsValidPasses() { + // positive above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + 0, + configuration + ) + } + + @Test + fun testNegativeAboveTheMinimumIsValidPasses() { + // negative above the minimum is valid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testIgnoresNonNumbersPasses() { + // ignores non-numbers + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + schema.validate( + "x", + configuration + ) + } + + @Test + fun testFloatBelowTheMinimumIsInvalidFails() { + // float below the minimum is invalid + val schema = MinimumValidationWithSignedInteger.MinimumValidationWithSignedInteger1.getInstance() + assertFailsWith( + block = { + schema.validate( + -2.0001, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt new file mode 100644 index 00000000000..f6dc4758197 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinitemsValidationTest.kt @@ -0,0 +1,64 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1 + ), + configuration + ) + } + + @Test + fun testIgnoresNonArraysPasses() { + // ignores non-arrays + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinitemsValidation.MinitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt new file mode 100644 index 00000000000..f8976f274c1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinlengthValidationTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinlengthValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "fo", + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testIgnoresNonStringsPasses() { + // ignores non-strings + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "f", + configuration + ) + } + ) + } + + @Test + fun testOneSupplementaryUnicodeCodePointIsNotLongEnoughFails() { + // one supplementary Unicode code point is not long enough + val schema = MinlengthValidation.MinlengthValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "💩", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt new file mode 100644 index 00000000000..3c6cd9d15ab --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MinpropertiesValidationTest.kt @@ -0,0 +1,94 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MinpropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testExactLengthIsValidPasses() { + // exact length is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testLongerIsValidPasses() { + // longer is valid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testTooShortIsInvalidFails() { + // too short is invalid + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = MinpropertiesValidation.MinpropertiesValidation1.getInstance() + schema.validate( + "", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt new file mode 100644 index 00000000000..81d0f0d188c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleDependentsRequiredTest.kt @@ -0,0 +1,132 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MultipleDependentsRequiredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNondependantsPasses() { + // nondependants + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testMissingOtherDependencyFails() { + // missing other dependency + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 1 + ), + Pair( + "quux", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWithDependenciesPasses() { + // with dependencies + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "quux", + 3 + ) + ), + configuration + ) + } + + @Test + fun testMissingBothDependenciesFails() { + // missing both dependencies + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "quux", + 1 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMissingDependencyFails() { + // missing dependency + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "quux", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNeitherPasses() { + // neither + val schema = MultipleDependentsRequired.MultipleDependentsRequired1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt new file mode 100644 index 00000000000..07ea957361d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleSimultaneousPatternpropertiesAreValidatedTest.kt @@ -0,0 +1,124 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MultipleSimultaneousPatternpropertiesAreValidatedTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testASimultaneousMatchIsValidPasses() { + // a simultaneous match is valid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + schema.validate( + mapOf( + Pair( + "aaaa", + 18 + ) + ), + configuration + ) + } + + @Test + fun testASingleValidMatchIsValidPasses() { + // a single valid match is valid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + 21 + ) + ), + configuration + ) + } + + @Test + fun testAnInvalidDueToTheOtherIsInvalidFails() { + // an invalid due to the other is invalid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "aaaa", + 31 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMultipleMatchesIsValidPasses() { + // multiple matches is valid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + 21 + ), + Pair( + "aaaa", + 18 + ) + ), + configuration + ) + } + + @Test + fun testAnInvalidDueToOneIsInvalidFails() { + // an invalid due to one is invalid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAnInvalidDueToBothIsInvalidFails() { + // an invalid due to both is invalid + val schema = MultipleSimultaneousPatternpropertiesAreValidated.MultipleSimultaneousPatternpropertiesAreValidated1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "aaa", + "foo" + ), + Pair( + "aaaa", + 31 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt new file mode 100644 index 00000000000..3feb395a8f7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/MultipleTypesCanBeSpecifiedInAnArrayTest.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class MultipleTypesCanBeSpecifiedInAnArrayTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsInvalidFails() { + // null is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsValidPasses() { + // an integer is valid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAnArrayIsInvalidFails() { + // an array is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testABooleanIsInvalidFails() { + // a boolean is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatIsInvalidFails() { + // a float is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testAStringIsValidPasses() { + // a string is valid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testAnObjectIsInvalidFails() { + // an object is invalid + val schema = MultipleTypesCanBeSpecifiedInAnArray.MultipleTypesCanBeSpecifiedInAnArray1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..8639f84f58d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAllofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAllofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAllofToCheckValidationSemantics.NestedAllofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..76f934637ab --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedAnyofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedAnyofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedAnyofToCheckValidationSemantics.NestedAnyofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt new file mode 100644 index 00000000000..7d7ab246886 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedItemsTest.kt @@ -0,0 +1,137 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNestedArrayWithInvalidTypeFails() { + // nested array with invalid type + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + listOf( + "1" + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ), + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNotDeepEnoughFails() { + // not deep enough + val schema = NestedItems.NestedItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + listOf( + 2 + ), + listOf( + 3 + ) + ), + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testValidNestedArrayPasses() { + // valid nested array + val schema = NestedItems.NestedItems1.getInstance() + schema.validate( + NestedItems.NestedItemsListBuilder() + .add( + listOf( + listOf( + listOf( + 1 + ) + ), + listOf( + listOf( + 2 + ), + listOf( + 3 + ) + ) + ) + ) + .add( + listOf( + listOf( + listOf( + 4 + ), + listOf( + 5 + ), + listOf( + 6 + ) + ) + ) + ) + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt new file mode 100644 index 00000000000..32e8f394a41 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NestedOneofToCheckValidationSemanticsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NestedOneofToCheckValidationSemanticsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAnythingNonNullIsInvalidFails() { + // anything non-null is invalid + val schema = NestedOneofToCheckValidationSemantics.NestedOneofToCheckValidationSemantics1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt new file mode 100644 index 00000000000..3c02d6f5bb1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonAsciiPatternWithAdditionalpropertiesTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NonAsciiPatternWithAdditionalpropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNotMatchingThePatternIsInvalidFails() { + // not matching the pattern is invalid + val schema = NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "élmény", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchingThePatternIsValidPasses() { + // matching the pattern is valid + val schema = NonAsciiPatternWithAdditionalproperties.NonAsciiPatternWithAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "ármányos", + 2 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt new file mode 100644 index 00000000000..a349a759359 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NonInterferenceAcrossCombinedSchemasTest.kt @@ -0,0 +1,34 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NonInterferenceAcrossCombinedSchemasTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidButWouldHaveBeenInvalidThroughElsePasses() { + // valid, but would have been invalid through else + val schema = NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1.getInstance() + schema.validate( + 3, + configuration + ) + } + + @Test + fun testValidButWouldHaveBeenInvalidThroughThenPasses() { + // valid, but would have been invalid through then + val schema = NonInterferenceAcrossCombinedSchemas.NonInterferenceAcrossCombinedSchemas1.getInstance() + schema.validate( + -100, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt new file mode 100644 index 00000000000..071a71852c6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMoreComplexSchemaTest.kt @@ -0,0 +1,58 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotMoreComplexSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOtherMatchPasses() { + // other match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testMismatchFails() { + // mismatch + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMatchPasses() { + // match + val schema = NotMoreComplexSchema.NotMoreComplexSchema1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt new file mode 100644 index 00000000000..cba1337cb5e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotMultipleTypesTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotMultipleTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOtherMismatchFails() { + // other mismatch + val schema = NotMultipleTypes.NotMultipleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testValidPasses() { + // valid + val schema = NotMultipleTypes.NotMultipleTypes1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testMismatchFails() { + // mismatch + val schema = NotMultipleTypes.NotMultipleTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt new file mode 100644 index 00000000000..5b208bae6d7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NotTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NotTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testDisallowedFails() { + // disallowed + val schema = Not.Not1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAllowedPasses() { + // allowed + val schema = Not.Not1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt new file mode 100644 index 00000000000..4aab8da29af --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NulCharactersInStringsTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NulCharactersInStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchStringWithNulPasses() { + // match string with nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + schema.validate( + "hello\u0000there", + configuration + ) + } + + @Test + fun testDoNotMatchStringLackingNulFails() { + // do not match string lacking nul + val schema = NulCharactersInStrings.NulCharactersInStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + "hellothere", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt new file mode 100644 index 00000000000..12779200f9c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NullTypeMatchesOnlyTheNullObjectTest.kt @@ -0,0 +1,152 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NullTypeMatchesOnlyTheNullObjectTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testZeroIsNotNullFails() { + // zero is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 0, + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotNullFails() { + // an array is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotNullFails() { + // an object is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testTrueIsNotNullFails() { + // true is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testFalseIsNotNullFails() { + // false is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + false, + configuration + ) + } + ) + } + + @Test + fun testNullIsNullPasses() { + // null is null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAStringIsNotNullFails() { + // a string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotNullFails() { + // an integer is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsNotNullFails() { + // an empty string is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotNullFails() { + // a float is not null + val schema = NullTypeMatchesOnlyTheNullObject.NullTypeMatchesOnlyTheNullObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt new file mode 100644 index 00000000000..1ba574586e4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/NumberTypeMatchesNumbersTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class NumberTypeMatchesNumbersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAFloatIsANumberPasses() { + // a float is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.1, + configuration + ) + } + + @Test + fun testAnIntegerIsANumberPasses() { + // an integer is a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1, + configuration + ) + } + + @Test + fun testAStringIsStillNotANumberEvenIfItLooksLikeOneFails() { + // a string is still not a number, even if it looks like one + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "1", + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotANumberFails() { + // a boolean is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAFloatWithZeroFractionalPartIsANumberAndAnIntegerPasses() { + // a float with zero fractional part is a number (and an integer) + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testNullIsNotANumberFails() { + // null is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotANumberFails() { + // a string is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAnArrayIsNotANumberFails() { + // an array is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotANumberFails() { + // an object is not a number + val schema = NumberTypeMatchesNumbers.NumberTypeMatchesNumbers1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt new file mode 100644 index 00000000000..aab7819536b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectPropertiesValidationTest.kt @@ -0,0 +1,119 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectPropertiesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothPropertiesPresentAndValidIsValidPasses() { + // both properties present and valid is valid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testDoesnTInvalidateOtherPropertiesPasses() { + // doesn't invalidate other properties + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "quux", + listOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testBothPropertiesInvalidIsInvalidFails() { + // both properties invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + ) + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testOnePropertyInvalidIsInvalidFails() { + // one property invalid is invalid + val schema = ObjectPropertiesValidation.ObjectPropertiesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt new file mode 100644 index 00000000000..16082afdb8d --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ObjectTypeMatchesObjectsTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ObjectTypeMatchesObjectsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnObjectIsAnObjectPasses() { + // an object is an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAnArrayIsNotAnObjectFails() { + // an array is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnIntegerIsNotAnObjectFails() { + // an integer is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAnObjectFails() { + // a boolean is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAStringIsNotAnObjectFails() { + // a string is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testAFloatIsNotAnObjectFails() { + // a float is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAnObjectFails() { + // null is not an object + val schema = ObjectTypeMatchesObjects.ObjectTypeMatchesObjects1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt new file mode 100644 index 00000000000..8f9fb57ea7b --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofComplexTypesTest.kt @@ -0,0 +1,90 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofComplexTypesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSecondOneofValidComplexPasses() { + // second oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ) + ), + configuration + ) + } + + @Test + fun testBothOneofValidComplexFails() { + // both oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "baz" + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testFirstOneofValidComplexPasses() { + // first oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testNeitherOneofValidComplexFails() { + // neither oneOf valid (complex) + val schema = OneofComplexTypes.OneofComplexTypes1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 2 + ), + Pair( + "bar", + "quux" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt new file mode 100644 index 00000000000..012d577b9ec --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testNeitherOneofValidFails() { + // neither oneOf valid + val schema = Oneof.Oneof1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.5, + configuration + ) + } + ) + } + + @Test + fun testSecondOneofValidPasses() { + // second oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 2.5, + configuration + ) + } + + @Test + fun testFirstOneofValidPasses() { + // first oneOf valid + val schema = Oneof.Oneof1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt new file mode 100644 index 00000000000..e5ec716ea82 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithBaseSchemaTest.kt @@ -0,0 +1,52 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithBaseSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMismatchBaseSchemaFails() { + // mismatch base schema + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } + + @Test + fun testOneOneofValidPasses() { + // one oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + schema.validate( + "foobar", + configuration + ) + } + + @Test + fun testBothOneofValidFails() { + // both oneOf valid + val schema = OneofWithBaseSchema.OneofWithBaseSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt new file mode 100644 index 00000000000..844584e08c3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithEmptySchemaTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithEmptySchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testOneValidValidPasses() { + // one valid - valid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithEmptySchema.OneofWithEmptySchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt new file mode 100644 index 00000000000..da6b03e6370 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/OneofWithRequiredTest.kt @@ -0,0 +1,98 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class OneofWithRequiredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFirstValidValidPasses() { + // first valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testBothValidInvalidFails() { + // both valid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testSecondValidValidPasses() { + // second valid - valid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "baz", + 3 + ) + ), + configuration + ) + } + + @Test + fun testBothInvalidInvalidFails() { + // both invalid - invalid + val schema = OneofWithRequired.OneofWithRequired1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt new file mode 100644 index 00000000000..3e54785ff69 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternIsNotAnchoredTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternIsNotAnchoredTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMatchesASubstringPasses() { + // matches a substring + val schema = PatternIsNotAnchored.PatternIsNotAnchored1.getInstance() + schema.validate( + "xxaayy", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt new file mode 100644 index 00000000000..0a4d35fd533 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternValidationTest.kt @@ -0,0 +1,100 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testIgnoresBooleansPasses() { + // ignores booleans + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + true, + configuration + ) + } + + @Test + fun testIgnoresFloatsPasses() { + // ignores floats + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 1.0, + configuration + ) + } + + @Test + fun testANonMatchingPatternIsInvalidFails() { + // a non-matching pattern is invalid + val schema = PatternValidation.PatternValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + "abc", + configuration + ) + } + ) + } + + @Test + fun testIgnoresIntegersPasses() { + // ignores integers + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + 123, + configuration + ) + } + + @Test + fun testAMatchingPatternIsValidPasses() { + // a matching pattern is valid + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + "aaa", + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresObjectsPasses() { + // ignores objects + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresNullPasses() { + // ignores null + val schema = PatternValidation.PatternValidation1.getInstance() + schema.validate( + null, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt new file mode 100644 index 00000000000..9a90d873082 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesValidatesPropertiesMatchingARegexTest.kt @@ -0,0 +1,126 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternpropertiesValidatesPropertiesMatchingARegexTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testMultipleInvalidMatchesIsInvalidFails() { + // multiple invalid matches is invalid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ), + Pair( + "foooooo", + "baz" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testASingleValidMatchIsValidPasses() { + // a single valid match is valid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testASingleInvalidMatchIsInvalidFails() { + // a single invalid match is invalid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "bar" + ), + Pair( + "fooooo", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testMultipleValidMatchesIsValidPasses() { + // multiple valid matches is valid + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "foooooo", + 2 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + listOf( + "foo" + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = PatternpropertiesValidatesPropertiesMatchingARegex.PatternpropertiesValidatesPropertiesMatchingARegex1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..aeda482d921 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PatternpropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PatternpropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuesPasses() { + // allows null values + val schema = PatternpropertiesWithNullValuedInstanceProperties.PatternpropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foobar", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt new file mode 100644 index 00000000000..804b01b6a7f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsValidationAdjustsTheStartingIndexForItemsTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PrefixitemsValidationAdjustsTheStartingIndexForItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidItemsPasses() { + // valid items + val schema = PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1.getInstance() + schema.validate( + PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItemsListBuilder() + .add("x") + + .add(2) + + .add(3) + + .build(), + configuration + ) + } + + @Test + fun testWrongTypeOfSecondItemFails() { + // wrong type of second item + val schema = PrefixitemsValidationAdjustsTheStartingIndexForItems.PrefixitemsValidationAdjustsTheStartingIndexForItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "x", + "y" + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..7a8883544df --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PrefixitemsWithNullInstanceElementsTest.kt @@ -0,0 +1,27 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PrefixitemsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullElementsPasses() { + // allows null elements + val schema = PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElements1.getInstance() + schema.validate( + PrefixitemsWithNullInstanceElements.PrefixitemsWithNullInstanceElementsListBuilder() + .add(null) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt new file mode 100644 index 00000000000..f35421aeef5 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesPatternpropertiesAdditionalpropertiesInteractionTest.kt @@ -0,0 +1,164 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesPatternpropertiesAdditionalpropertiesInteractionTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyValidatesPropertyPasses() { + // property validates property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + listOf( + 1, + 2 + ) + ) + ), + configuration + ) + } + + @Test + fun testAdditionalpropertyIgnoresPropertyPasses() { + // additionalProperty ignores property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "bar", + listOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testPatternpropertyInvalidatesPropertyFails() { + // patternProperty invalidates property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPatternpropertyValidatesNonpropertyPasses() { + // patternProperty validates nonproperty + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "fxo", + listOf( + 1, + 2 + ) + ) + ), + configuration + ) + } + + @Test + fun testPatternpropertyInvalidatesNonpropertyFails() { + // patternProperty invalidates nonproperty + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "fxo", + listOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyInvalidatesPropertyFails() { + // property invalidates property + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + listOf( + 1, + 2, + 3, + 4 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAdditionalpropertyInvalidatesOthersFails() { + // additionalProperty invalidates others + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "quux", + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAdditionalpropertyValidatesOthersPasses() { + // additionalProperty validates others + val schema = PropertiesPatternpropertiesAdditionalpropertiesInteraction.PropertiesPatternpropertiesAdditionalpropertiesInteraction1.getInstance() + schema.validate( + mapOf( + Pair( + "quux", + 3 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt new file mode 100644 index 00000000000..9b6f913d5fc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt @@ -0,0 +1,141 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testProtoNotValidFails() { + // __proto__ not valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "__proto__", + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoneOfThePropertiesMentionedPasses() { + // none of the properties mentioned + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllPresentAndValidPasses() { + // all present and valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + mapOf( + Pair( + "__proto__", + 12 + ), + Pair( + "toString", + mapOf( + Pair( + "length", + "foo" + ) + ) + ), + Pair( + "constructor", + 37 + ) + ), + configuration + ) + } + + @Test + fun testConstructorNotValidFails() { + // constructor not valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "constructor", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testTostringNotValidFails() { + // toString not valid + val schema = PropertiesWhoseNamesAreJavascriptObjectPropertyNames.PropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "toString", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b65f4a4fbd2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithEscapedCharactersTest.kt @@ -0,0 +1,88 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithAllNumbersIsValidPasses() { + // object with all numbers is valid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } + + @Test + fun testObjectWithStringsIsInvalidFails() { + // object with strings is invalid + val schema = PropertiesWithEscapedCharacters.PropertiesWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ), + Pair( + "foo\\bar", + "1" + ), + Pair( + "foo\rbar", + "1" + ), + Pair( + "foo\tbar", + "1" + ), + Pair( + "foo\u000Cbar", + "1" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..680dbf7f86f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuesPasses() { + // allows null values + val schema = PropertiesWithNullValuedInstanceProperties.PropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt new file mode 100644 index 00000000000..297e5ed5792 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertyNamedRefThatIsNotAReferenceTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertyNamedRefThatIsNotAReferenceTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNamedRefValidPasses() { + // property named \$ref valid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + schema.validate( + mapOf( + Pair( + "\$ref", + "a" + ) + ), + configuration + ) + } + + @Test + fun testPropertyNamedRefInvalidFails() { + // property named \$ref invalid + val schema = PropertyNamedRefThatIsNotAReference.PropertyNamedRefThatIsNotAReference1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "\$ref", + 2 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt new file mode 100644 index 00000000000..3aa3473a19e --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/PropertynamesValidationTest.kt @@ -0,0 +1,106 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class PropertynamesValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSomePropertyNamesInvalidFails() { + // some property names invalid + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + mapOf( + ) + ), + Pair( + "foobar", + mapOf( + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllPropertyNamesValidPasses() { + // all property names valid + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "f", + mapOf( + ) + ), + Pair( + "foo", + mapOf( + ) + ) + ), + configuration + ) + } + + @Test + fun testObjectWithoutPropertiesIsValidPasses() { + // object without properties is valid + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3, + 4 + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = PropertynamesValidation.PropertynamesValidation1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt new file mode 100644 index 00000000000..4a9ef49d11f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RegexFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testInvalidRegexStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid regex string is only an annotation by default + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + "^(abc]", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = RegexFormat.RegexFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt new file mode 100644 index 00000000000..daaaab30bb7 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest.kt @@ -0,0 +1,82 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RegexesAreNotAnchoredByDefaultAndAreCaseSensitiveTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testRegexesAreCaseSensitivePasses() { + // regexes are case sensitive + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + schema.validate( + mapOf( + Pair( + "a_x_3", + 3 + ) + ), + configuration + ) + } + + @Test + fun testNonRecognizedMembersAreIgnoredPasses() { + // non recognized members are ignored + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + schema.validate( + mapOf( + Pair( + "answer 1", + "42" + ) + ), + configuration + ) + } + + @Test + fun testRecognizedMembersAreAccountedForFails() { + // recognized members are accounted for + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a31b", + null + ) + ), + configuration + ) + } + ) + } + + @Test + fun testRegexesAreCaseSensitive2Fails() { + // regexes are case sensitive, 2 + val schema = RegexesAreNotAnchoredByDefaultAndAreCaseSensitive.RegexesAreNotAnchoredByDefaultAndAreCaseSensitive1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a_X_3", + 3 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt new file mode 100644 index 00000000000..a0ce6245290 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RelativeJsonPointerFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RelativeJsonPointerFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testInvalidRelativeJsonPointerStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid relative-json-pointer string is only an annotation by default + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + "/foo/bar", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = RelativeJsonPointerFormat.RelativeJsonPointerFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt new file mode 100644 index 00000000000..8512a0f489f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredDefaultValidationTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredDefaultValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNotRequiredByDefaultPasses() { + // not required by default + val schema = RequiredDefaultValidation.RequiredDefaultValidation1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt new file mode 100644 index 00000000000..ab005b39610 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest.kt @@ -0,0 +1,145 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNamesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTostringPresentFails() { + // toString present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "toString", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNoneOfThePropertiesMentionedFails() { + // none of the properties mentioned + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testConstructorPresentFails() { + // constructor present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "constructor", + mapOf( + Pair( + "length", + 37 + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAllPresentPasses() { + // all present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + mapOf( + Pair( + "__proto__", + 12 + ), + Pair( + "toString", + mapOf( + Pair( + "length", + "foo" + ) + ) + ), + Pair( + "constructor", + 37 + ) + ), + configuration + ) + } + + @Test + fun testProtoPresentFails() { + // __proto__ present + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "__proto__", + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames.RequiredPropertiesWhoseNamesAreJavascriptObjectPropertyNames1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt new file mode 100644 index 00000000000..c5815409b38 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredValidationTest.kt @@ -0,0 +1,79 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPresentRequiredPropertyIsValidPasses() { + // present required property is valid + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = RequiredValidation.RequiredValidation1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testNonPresentRequiredPropertyIsInvalidFails() { + // non-present required property is invalid + val schema = RequiredValidation.RequiredValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 1 + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt new file mode 100644 index 00000000000..4f5162d7519 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEmptyArrayTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEmptyArrayTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testPropertyNotRequiredPasses() { + // property not required + val schema = RequiredWithEmptyArray.RequiredWithEmptyArray1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt new file mode 100644 index 00000000000..b3b2e3a223f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/RequiredWithEscapedCharactersTest.kt @@ -0,0 +1,72 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class RequiredWithEscapedCharactersTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testObjectWithSomePropertiesMissingIsInvalidFails() { + // object with some properties missing is invalid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo\nbar", + "1" + ), + Pair( + "foo\"bar", + "1" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testObjectWithAllPropertiesPresentIsValidPasses() { + // object with all properties present is valid + val schema = RequiredWithEscapedCharacters.RequiredWithEscapedCharacters1.getInstance() + schema.validate( + mapOf( + Pair( + "foo\nbar", + 1 + ), + Pair( + "foo\"bar", + 1 + ), + Pair( + "foo\\bar", + 1 + ), + Pair( + "foo\rbar", + 1 + ), + Pair( + "foo\tbar", + 1 + ), + Pair( + "foo\u000Cbar", + 1 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt new file mode 100644 index 00000000000..88f0fb9321f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SimpleEnumValidationTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SimpleEnumValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testSomethingElseIsInvalidFails() { + // something else is invalid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + 4, + configuration + ) + } + ) + } + + @Test + fun testOneOfTheEnumIsValidPasses() { + // one of the enum is valid + val schema = SimpleEnumValidation.SimpleEnumValidation1.getInstance() + schema.validate( + 1, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt new file mode 100644 index 00000000000..0d54f1a75ac --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SingleDependencyTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SingleDependencyTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNondependantPasses() { + // nondependant + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ) + ), + configuration + ) + } + + @Test + fun testWithDependencyPasses() { + // with dependency + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 1 + ), + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + + @Test + fun testMissingDependencyFails() { + // missing dependency + val schema = SingleDependency.SingleDependency1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "bar", + 2 + ) + ), + configuration + ) + } + ) + } + + @Test + fun testIgnoresOtherNonObjectsPasses() { + // ignores other non-objects + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testIgnoresArraysPasses() { + // ignores arrays + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + listOf( + "bar" + ), + configuration + ) + } + + @Test + fun testNeitherPasses() { + // neither + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testIgnoresStringsPasses() { + // ignores strings + val schema = SingleDependency.SingleDependency1.getInstance() + schema.validate( + "foobar", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt new file mode 100644 index 00000000000..296a6dd7e02 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/SmallMultipleOfLargeIntegerTest.kt @@ -0,0 +1,24 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class SmallMultipleOfLargeIntegerTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAnyIntegerIsAMultipleOf1E8Passes() { + // any integer is a multiple of 1e-8 + val schema = SmallMultipleOfLargeInteger.SmallMultipleOfLargeInteger1.getInstance() + schema.validate( + 12391239123L, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt new file mode 100644 index 00000000000..4c9aafdb869 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/StringTypeMatchesStringsTest.kt @@ -0,0 +1,130 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class StringTypeMatchesStringsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAStringIsStillAStringEvenIfItLooksLikeANumberPasses() { + // a string is still a string, even if it looks like a number + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "1", + configuration + ) + } + + @Test + fun test1IsNotAStringFails() { + // 1 is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1, + configuration + ) + } + ) + } + + @Test + fun testABooleanIsNotAStringFails() { + // a boolean is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + true, + configuration + ) + } + ) + } + + @Test + fun testAnEmptyStringIsStillAStringPasses() { + // an empty string is still a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "", + configuration + ) + } + + @Test + fun testAnArrayIsNotAStringFails() { + // an array is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + ), + configuration + ) + } + ) + } + + @Test + fun testAnObjectIsNotAStringFails() { + // an object is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + ), + configuration + ) + } + ) + } + + @Test + fun testNullIsNotAStringFails() { + // null is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testAStringIsAStringPasses() { + // a string is a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + schema.validate( + "foo", + configuration + ) + } + + @Test + fun testAFloatIsNotAStringFails() { + // a float is not a string + val schema = StringTypeMatchesStrings.StringTypeMatchesStrings1.getInstance() + assertFailsWith( + block = { + schema.validate( + 1.1, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt new file mode 100644 index 00000000000..4cb811700a1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TimeFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TimeFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidTimeStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid time string is only an annotation by default + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + "08:30:06 PST", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = TimeFormat.TimeFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt new file mode 100644 index 00000000000..700f58e1ed2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayObjectOrNullTest.kt @@ -0,0 +1,81 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TypeArrayObjectOrNullTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsInvalidFails() { + // number is invalid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } + + @Test + fun testNullIsValidPasses() { + // null is valid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testArrayIsValidPasses() { + // array is valid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testObjectIsValidPasses() { + // object is valid + val schema = TypeArrayObjectOrNull.TypeArrayObjectOrNull1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 123 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt new file mode 100644 index 00000000000..2e7a42c916f --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeArrayOrObjectTest.kt @@ -0,0 +1,85 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TypeArrayOrObjectTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsInvalidFails() { + // number is invalid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } + + @Test + fun testStringIsInvalidFails() { + // string is invalid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + "foo", + configuration + ) + } + ) + } + + @Test + fun testNullIsInvalidFails() { + // null is invalid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + assertFailsWith( + block = { + schema.validate( + null, + configuration + ) + } + ) + } + + @Test + fun testArrayIsValidPasses() { + // array is valid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + schema.validate( + listOf( + 1, + 2, + 3 + ), + configuration + ) + } + + @Test + fun testObjectIsValidPasses() { + // object is valid + val schema = TypeArrayOrObject.TypeArrayOrObject1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + 123 + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt new file mode 100644 index 00000000000..2e78c880ba4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/TypeAsArrayWithOneItemTest.kt @@ -0,0 +1,38 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class TypeAsArrayWithOneItemTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumberIsInvalidFails() { + // number is invalid + val schema = TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1.getInstance() + assertFailsWith( + block = { + schema.validate( + 123, + configuration + ) + } + ) + } + + @Test + fun testStringIsValidPasses() { + // string is valid + val schema = TypeAsArrayWithOneItem.TypeAsArrayWithOneItem1.getInstance() + schema.validate( + "foo", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt new file mode 100644 index 00000000000..4e6b0e1ea97 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsAsSchemaTest.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsAsSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWithValidUnevaluatedItemsPasses() { + // with valid unevaluated items + val schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance() + schema.validate( + listOf( + "foo" + ), + configuration + ) + } + + @Test + fun testWithInvalidUnevaluatedItemsFails() { + // with invalid unevaluated items + val schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 42 + ), + configuration + ) + } + ) + } + + @Test + fun testWithNoUnevaluatedItemsPasses() { + // with no unevaluated items + val schema = UnevaluateditemsAsSchema.UnevaluateditemsAsSchema1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt new file mode 100644 index 00000000000..db6b9f6a625 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsDependsOnMultipleNestedContainsTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsDependsOnMultipleNestedContainsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun test7NotEvaluatedFailsUnevaluateditemsFails() { + // 7 not evaluated, fails unevaluatedItems + val schema = UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 2, + 3, + 4, + 7, + 8 + ), + configuration + ) + } + ) + } + + @Test + fun test5NotEvaluatedPassesUnevaluateditemsPasses() { + // 5 not evaluated, passes unevaluatedItems + val schema = UnevaluateditemsDependsOnMultipleNestedContains.UnevaluateditemsDependsOnMultipleNestedContains1.getInstance() + schema.validate( + listOf( + 2, + 3, + 4, + 5, + 6 + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt new file mode 100644 index 00000000000..c622a8fc46c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithItemsTest.kt @@ -0,0 +1,51 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsWithItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testInvalidUnderItemsFails() { + // invalid under items + val schema = UnevaluateditemsWithItems.UnevaluateditemsWithItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + "bar", + "baz" + ), + configuration + ) + } + ) + } + + @Test + fun testValidUnderItemsPasses() { + // valid under items + val schema = UnevaluateditemsWithItems.UnevaluateditemsWithItems1.getInstance() + schema.validate( + UnevaluateditemsWithItems.UnevaluateditemsWithItemsListBuilder() + .add(5) + + .add(6) + + .add(7) + + .add(8) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt new file mode 100644 index 00000000000..4f5bffa7c26 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluateditemsWithNullInstanceElementsTest.kt @@ -0,0 +1,26 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluateditemsWithNullInstanceElementsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullElementsPasses() { + // allows null elements + val schema = UnevaluateditemsWithNullInstanceElements.UnevaluateditemsWithNullInstanceElements1.getInstance() + schema.validate( + listOf( + null + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt new file mode 100644 index 00000000000..d77152f1830 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesNotAffectedByPropertynamesTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesNotAffectedByPropertynamesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsOnlyNumberPropertiesPasses() { + // allows only number properties + val schema = UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1.getInstance() + schema.validate( + mapOf( + Pair( + "a", + 1 + ) + ), + configuration + ) + } + + @Test + fun testStringPropertyIsInvalidFails() { + // string property is invalid + val schema = UnevaluatedpropertiesNotAffectedByPropertynames.UnevaluatedpropertiesNotAffectedByPropertynames1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "a", + "b" + ) + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt new file mode 100644 index 00000000000..6e931c25f7c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesSchemaTest.kt @@ -0,0 +1,59 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesSchemaTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWithInvalidUnevaluatedPropertiesFails() { + // with invalid unevaluated properties + val schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance() + assertFailsWith( + block = { + schema.validate( + mapOf( + Pair( + "foo", + "fo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testWithNoUnevaluatedPropertiesPasses() { + // with no unevaluated properties + val schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testWithValidUnevaluatedPropertiesPasses() { + // with valid unevaluated properties + val schema = UnevaluatedpropertiesSchema.UnevaluatedpropertiesSchema1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt new file mode 100644 index 00000000000..41de9832e10 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest.kt @@ -0,0 +1,48 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesWithAdjacentAdditionalpropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testWithAdditionalPropertiesPasses() { + // with additional properties + val schema = UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ), + Pair( + "bar", + "bar" + ) + ), + configuration + ) + } + + @Test + fun testWithNoAdditionalPropertiesPasses() { + // with no additional properties + val schema = UnevaluatedpropertiesWithAdjacentAdditionalproperties.UnevaluatedpropertiesWithAdjacentAdditionalproperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + "foo" + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt new file mode 100644 index 00000000000..03747042a81 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UnevaluatedpropertiesWithNullValuedInstancePropertiesTest.kt @@ -0,0 +1,29 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UnevaluatedpropertiesWithNullValuedInstancePropertiesTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllowsNullValuedPropertiesPasses() { + // allows null valued properties + val schema = UnevaluatedpropertiesWithNullValuedInstanceProperties.UnevaluatedpropertiesWithNullValuedInstanceProperties1.getInstance() + schema.validate( + mapOf( + Pair( + "foo", + null + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt new file mode 100644 index 00000000000..4c5cff32904 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseValidationTest.kt @@ -0,0 +1,312 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsFalseValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalPasses() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsValidPasses() { + // non-unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsValidPasses() { + // non-unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsValidPasses() { + // non-unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // 1 and true are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreValidPasses() { + // non-unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // 0 and false are unique + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1 + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsValidPasses() { + // non-unique array of nested objects is valid + val schema = UniqueitemsFalseValidation.UniqueitemsFalseValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt new file mode 100644 index 00000000000..8028a0182f1 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsFalseWithAnArrayOfItemsTest.kt @@ -0,0 +1,150 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsFalseWithAnArrayOfItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testFalseFalseFromItemsArrayIsValidPasses() { + // [false, false] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(false) + + .build(), + configuration + ) + } + + @Test + fun testNonUniqueArrayExtendedFromFalseTrueIsValidPasses() { + // non-unique array extended from [false, true] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .add("foo") + + .add("foo") + + .build(), + configuration + ) + } + + @Test + fun testTrueTrueFromItemsArrayIsValidPasses() { + // [true, true] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testUniqueArrayExtendedFromFalseTrueIsValidPasses() { + // unique array extended from [false, true] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testUniqueArrayExtendedFromTrueFalseIsValidPasses() { + // unique array extended from [true, false] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testFalseTrueFromItemsArrayIsValidPasses() { + // [false, true] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testTrueFalseFromItemsArrayIsValidPasses() { + // [true, false] from items array is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .build(), + configuration + ) + } + + @Test + fun testNonUniqueArrayExtendedFromTrueFalseIsValidPasses() { + // non-unique array extended from [true, false] is valid + val schema = UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsFalseWithAnArrayOfItems.UniqueitemsFalseWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .add("foo") + + .add("foo") + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt new file mode 100644 index 00000000000..9a77d6a58a3 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsValidationTest.kt @@ -0,0 +1,612 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsValidationTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoIntegersIsInvalidFails() { + // non-unique array of more than two integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 2, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfObjectsIsInvalidFails() { + // non-unique array of objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testPropertyOrderOfArrayOfObjectsIsIgnoredFails() { + // property order of array of objects is ignored + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ), + Pair( + "bar", + "foo" + ) + ), + mapOf( + Pair( + "bar", + "foo" + ), + Pair( + "foo", + "bar" + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testATrueAndA1AreUniquePasses() { + // {\\\"a\\\": true} and {\\\"a\\\": 1} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + true + ) + ), + mapOf( + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun test1AndTrueAreUniquePasses() { + // [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 1 + ), + listOf( + true + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfIntegersIsInvalidFails() { + // non-unique array of integers is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNested0AndFalseAreUniquePasses() { + // nested [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 0 + ), + "foo" + ), + listOf( + listOf( + false + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testObjectsAreNonUniqueDespiteKeyOrderFails() { + // objects are non-unique despite key order + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "b", + 2 + ), + Pair( + "a", + 1 + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfArraysIsInvalidFails() { + // non-unique array of arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun testAFalseAndA0AreUniquePasses() { + // {\\\"a\\\": false} and {\\\"a\\\": 0} are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + false + ) + ), + mapOf( + Pair( + "a", + 0 + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfMoreThanTwoArraysIsInvalidFails() { + // non-unique array of more than two arrays is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ), + listOf( + "foo" + ) + ), + configuration + ) + } + ) + } + + @Test + fun test0AndFalseAreUniquePasses() { + // [0] and [false] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + 0 + ), + listOf( + false + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueArrayOfNestedObjectsIsInvalidFails() { + // non-unique array of nested objects is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + ) + } + + @Test + fun testNumbersAreUniqueIfMathematicallyUnequalFails() { + // numbers are unique if mathematically unequal + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + 1.0, + 1.0, + 1 + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayOfStringsIsInvalidFails() { + // non-unique array of strings is invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + "foo", + "bar", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayOfNestedObjectsIsValidPasses() { + // unique array of nested objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + true + ) + ) + ) + ) + ) + ), + mapOf( + Pair( + "foo", + mapOf( + Pair( + "bar", + mapOf( + Pair( + "baz", + false + ) + ) + ) + ) + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfArraysIsValidPasses() { + // unique array of arrays is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + "foo" + ), + listOf( + "bar" + ) + ), + configuration + ) + } + + @Test + fun testTrueIsNotEqualToOnePasses() { + // true is not equal to one + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + true + ), + configuration + ) + } + + @Test + fun testNested1AndTrueAreUniquePasses() { + // nested [1] and [true] are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + listOf( + listOf( + 1 + ), + "foo" + ), + listOf( + listOf( + true + ), + "foo" + ) + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfStringsIsValidPasses() { + // unique array of strings is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + "foo", + "bar", + "baz" + ), + configuration + ) + } + + @Test + fun testFalseIsNotEqualToZeroPasses() { + // false is not equal to zero + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 0, + false + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfIntegersIsValidPasses() { + // unique array of integers is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + 1, + 2 + ), + configuration + ) + } + + @Test + fun testDifferentObjectsAreUniquePasses() { + // different objects are unique + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "a", + 1 + ), + Pair( + "b", + 2 + ) + ), + mapOf( + Pair( + "a", + 2 + ), + Pair( + "b", + 1 + ) + ) + ), + configuration + ) + } + + @Test + fun testUniqueHeterogeneousTypesAreValidPasses() { + // unique heterogeneous types are valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + 1, + "{}" + ), + configuration + ) + } + + @Test + fun testUniqueArrayOfObjectsIsValidPasses() { + // unique array of objects is valid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + schema.validate( + listOf( + mapOf( + Pair( + "foo", + "bar" + ) + ), + mapOf( + Pair( + "foo", + "baz" + ) + ) + ), + configuration + ) + } + + @Test + fun testNonUniqueHeterogeneousTypesAreInvalidFails() { + // non-unique heterogeneous types are invalid + val schema = UniqueitemsValidation.UniqueitemsValidation1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + mapOf( + ), + listOf( + 1 + ), + true, + null, + mapOf( + ), + 1 + ), + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt new file mode 100644 index 00000000000..0dbd1f5a1af --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UniqueitemsWithAnArrayOfItemsTest.kt @@ -0,0 +1,154 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UniqueitemsWithAnArrayOfItemsTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testTrueTrueFromItemsArrayIsNotValidFails() { + // [true, true] from items array is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + true, + true + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayExtendedFromFalseTrueIsValidPasses() { + // unique array extended from [false, true] is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testFalseFalseFromItemsArrayIsNotValidFails() { + // [false, false] from items array is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + false, + false + ), + configuration + ) + } + ) + } + + @Test + fun testUniqueArrayExtendedFromTrueFalseIsValidPasses() { + // unique array extended from [true, false] is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .add("foo") + + .add("bar") + + .build(), + configuration + ) + } + + @Test + fun testNonUniqueArrayExtendedFromFalseTrueIsNotValidFails() { + // non-unique array extended from [false, true] is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + false, + true, + "foo", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testNonUniqueArrayExtendedFromTrueFalseIsNotValidFails() { + // non-unique array extended from [true, false] is not valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + assertFailsWith( + block = { + schema.validate( + listOf( + true, + false, + "foo", + "foo" + ), + configuration + ) + } + ) + } + + @Test + fun testFalseTrueFromItemsArrayIsValidPasses() { + // [false, true] from items array is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(false) + + .add(true) + + .build(), + configuration + ) + } + + @Test + fun testTrueFalseFromItemsArrayIsValidPasses() { + // [true, false] from items array is valid + val schema = UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItems1.getInstance() + schema.validate( + UniqueitemsWithAnArrayOfItems.UniqueitemsWithAnArrayOfItemsListBuilder() + .add(true) + + .add(false) + + .build(), + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt new file mode 100644 index 00000000000..f4b0ed4f75a --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidUriStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uri string is only an annotation by default + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + "//foo.bar/?baz=qux#quux", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriFormat.UriFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt new file mode 100644 index 00000000000..43d397d4188 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriReferenceFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriReferenceFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testInvalidUriReferenceStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uri-reference string is only an annotation by default + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + "\\\\WINDOWS\\fileshare", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriReferenceFormat.UriReferenceFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt new file mode 100644 index 00000000000..84b4cadc428 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UriTemplateFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UriTemplateFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + false, + configuration + ) + } + + @Test + fun testInvalidUriTemplateStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uri-template string is only an annotation by default + val schema = UriTemplateFormat.UriTemplateFormat1.getInstance() + schema.validate( + "http://example.com/dictionary/{term:1}/{term", + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt new file mode 100644 index 00000000000..1d75aad55d4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/UuidFormatTest.kt @@ -0,0 +1,86 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class UuidFormatTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testAllStringFormatsIgnoreIntegersPasses() { + // all string formats ignore integers + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + 12, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreNullsPasses() { + // all string formats ignore nulls + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + null, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreObjectsPasses() { + // all string formats ignore objects + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + mapOf( + ), + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreFloatsPasses() { + // all string formats ignore floats + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + 13.7, + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreArraysPasses() { + // all string formats ignore arrays + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + listOf( + ), + configuration + ) + } + + @Test + fun testInvalidUuidStringIsOnlyAnAnnotationByDefaultPasses() { + // invalid uuid string is only an annotation by default + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + "2eb8aa08-aa98-11ea-b4aa-73b441d1638", + configuration + ) + } + + @Test + fun testAllStringFormatsIgnoreBooleansPasses() { + // all string formats ignore booleans + val schema = UuidFormat.UuidFormat1.getInstance() + schema.validate( + false, + configuration + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt new file mode 100644 index 00000000000..19105537ccd --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/components/schemas/ValidateAgainstCorrectBranchThenVsElseTest.kt @@ -0,0 +1,62 @@ +package org.openapijsonschematools.client.components.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +class ValidateAgainstCorrectBranchThenVsElseTest { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } + + @Test + fun testValidThroughThenPasses() { + // valid through then + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + schema.validate( + -1, + configuration + ) + } + + @Test + fun testInvalidThroughThenFails() { + // invalid through then + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + assertFailsWith( + block = { + schema.validate( + -100, + configuration + ) + } + ) + } + + @Test + fun testValidThroughElsePasses() { + // valid through else + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + schema.validate( + 4, + configuration + ) + } + + @Test + fun testInvalidThroughElseFails() { + // invalid through else + val schema = ValidateAgainstCorrectBranchThenVsElse.ValidateAgainstCorrectBranchThenVsElse1.getInstance() + assertFailsWith( + block = { + schema.validate( + 3, + configuration + ) + } + ) + } +} diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt new file mode 100644 index 00000000000..cab27673567 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.kt @@ -0,0 +1,141 @@ +package org.openapijsonschematools.client.configurations; + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaKeywordFlagsTest { + @Test + fun testGetEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + expectedEnabledKeywords.add("additionalProperties") + expectedEnabledKeywords.add("allOf") + expectedEnabledKeywords.add("anyOf") + expectedEnabledKeywords.add("const") + expectedEnabledKeywords.add("contains") + expectedEnabledKeywords.add("dependentRequired") + expectedEnabledKeywords.add("dependentSchemas") + expectedEnabledKeywords.add("discriminator") + expectedEnabledKeywords.add("else_") + expectedEnabledKeywords.add("enum_") + expectedEnabledKeywords.add("exclusiveMaximum") + expectedEnabledKeywords.add("exclusiveMinimum") + expectedEnabledKeywords.add("format") + expectedEnabledKeywords.add("if_") + expectedEnabledKeywords.add("maximum") + expectedEnabledKeywords.add("minimum") + expectedEnabledKeywords.add("items") + expectedEnabledKeywords.add("maxContains") + expectedEnabledKeywords.add("maxItems") + expectedEnabledKeywords.add("maxLength") + expectedEnabledKeywords.add("maxProperties") + expectedEnabledKeywords.add("minContains") + expectedEnabledKeywords.add("minItems") + expectedEnabledKeywords.add("minLength") + expectedEnabledKeywords.add("minProperties") + expectedEnabledKeywords.add("multipleOf") + expectedEnabledKeywords.add("not") + expectedEnabledKeywords.add("oneOf") + expectedEnabledKeywords.add("pattern") + expectedEnabledKeywords.add("patternProperties") + expectedEnabledKeywords.add("prefixItems") + expectedEnabledKeywords.add("properties") + expectedEnabledKeywords.add("propertyNames") + expectedEnabledKeywords.add("required") + expectedEnabledKeywords.add("then") + expectedEnabledKeywords.add("type") + expectedEnabledKeywords.add("uniqueItems") + expectedEnabledKeywords.add("unevaluatedItems") + expectedEnabledKeywords.add("unevaluatedProperties") + assertEquals(enabledKeywords, expectedEnabledKeywords) + } + + @Test + fun testGetNoEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + assertEquals(enabledKeywords, expectedEnabledKeywords) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt new file mode 100644 index 00000000000..74571be8bc2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/AnyTypeSchemaTest.kt @@ -0,0 +1,113 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.FrozenMap + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class AnyTypeSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = schema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateBoolean() { + val trueValue = schema.validate(true, configuration) + assertTrue(trueValue) + val falseValue = schema.validate(false, configuration) + assertFalse(falseValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = schema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = schema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = schema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = schema.validate(70.6458763, configuration) + assertEquals(validatedValue.compareTo(70.6458763).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateString() { + val validatedValue = schema.validate("a", configuration) + assertEquals(validatedValue, "a") + } + + @Test + @Throws(ValidationException::class) + fun testValidateZonedDateTime() { + val validatedValue = + schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration) + assertEquals(validatedValue, "2017-07-21T17:32:28Z") + } + + @Test + @Throws(ValidationException::class) + fun testValidateLocalDate() { + val validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration) + assertEquals(validatedValue, "2017-07-21") + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap = mapOf( + "today" to LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenMap<*> = schema.validate(inMap, configuration) + val outMap: Map = mapOf( + "today" to "2017-07-21" + ) + assertEquals(validatedValue, outMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList = listOf( + LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenList<*> = schema.validate(inList, configuration) + val outList: List = listOf("2017-07-21") + assertEquals(validatedValue, outList) + } + + companion object { + val schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt new file mode 100644 index 00000000000..79c24c6cb44 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ArrayTypeSchemaTest.kt @@ -0,0 +1,251 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ListSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ArrayTypeSchemaTest { + sealed interface ArrayWithItemsSchemaBoxed + + data class ArrayWithItemsSchemaBoxedList(val data: FrozenList) : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxedList { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + class ArrayWithOutputClsSchemaList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + return ArrayWithOutputClsSchema().validate(arg, configuration) + } + } + } + + interface ArrayWithOutputClsSchemaBoxed + + data class ArrayWithOutputClsSchemaBoxedList(val data: ArrayWithOutputClsSchemaList) : + ArrayWithOutputClsSchemaBoxed + + class ArrayWithOutputClsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ArrayWithOutputClsSchemaList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + val newInstanceItems = FrozenList(items) + return ArrayWithOutputClsSchemaList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): ArrayWithOutputClsSchemaBoxedList { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithItemsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue: FrozenList = ArrayWithItemsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithItemsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + intList, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithOutputClsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithOutputClsSchema(), + intList, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt new file mode 100644 index 00000000000..4afe62df020 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/BooleanSchemaTest.kt @@ -0,0 +1,53 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class BooleanSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = booleanJsonSchema.validate(true, configuration) + assertTrue(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = booleanJsonSchema.validate(false, configuration) + assertFalse(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt new file mode 100644 index 00000000000..6aa74e7b8dc --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListBuilderTest.kt @@ -0,0 +1,55 @@ +package org.openapijsonschematools.client.schemas + +import kotlin.test.Test +import kotlin.test.assertEquals + +class ListBuilderTest { + class NullableListWithNullableItemsListBuilder { + // class to build List<@Nullable List> + private val list: MutableList?> + + constructor() { + list = ArrayList() + } + + constructor(list: MutableList?>) { + this.list = list + } + + fun add(item: Nothing?): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun build(): List?> { + return list + } + } + + @Test + fun testSucceedsWithNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(null) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(null) + assertEquals(inList, builder.build()) + } + + @Test + fun testSucceedsWithNonNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(listOf(1)) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(listOf(1)) + assertEquals(inList, builder.build()) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt new file mode 100644 index 00000000000..494fd110f59 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ListSchemaTest.kt @@ -0,0 +1,49 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenList +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ListSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList: MutableList = ArrayList() + inList.add("today") + val validatedValue = listJsonSchema.validate(inList, configuration) + val outList: List = listOf("today") + assertEquals(validatedValue, outList) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt new file mode 100644 index 00000000000..bfcd692cb86 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/MapSchemaTest.kt @@ -0,0 +1,50 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class MapSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap: MutableMap = LinkedHashMap() + inMap["today"] = LocalDate.of(2017, 7, 21) + val validatedValue = mapJsonSchema.validate(inMap, configuration) + val outMap: Map = mapOf("today" to "2017-07-21") + assertEquals(validatedValue, outMap) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt new file mode 100644 index 00000000000..a096b91adf2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NullSchemaTest.kt @@ -0,0 +1,46 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.Throws +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class NullSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = nullJsonSchema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + nullJsonSchema, + true, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt new file mode 100644 index 00000000000..db8bd160ce2 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/NumberSchemaTest.kt @@ -0,0 +1,66 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class NumberSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = numberJsonSchema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = numberJsonSchema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = numberJsonSchema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = numberJsonSchema.validate(3.14, configuration) + assertEquals(validatedValue.compareTo(3.14).toLong(), 0) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt new file mode 100644 index 00000000000..a87586e8b15 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/ObjectTypeSchemaTest.kt @@ -0,0 +1,569 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.JsonSchemaInfo +import org.openapijsonschematools.client.schemas.validation.FrozenMap +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.MapSchemaValidator +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ObjectTypeSchemaTest { + interface ObjectWithPropsSchemaBoxed + + data class ObjectWithPropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsSchemaBoxedMap { + return ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsSchemaBoxedMap( + validate(arg, configuration) + ) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + interface ObjectWithAddpropsSchemaBoxed + + data class ObjectWithAddpropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithAddpropsSchemaBoxed {} + + class ObjectWithAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Invalid type for property value") + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithAddpropsSchemaBoxedMap { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithAddpropsSchema().also { instance = it } + } + } + } + + interface ObjectWithPropsAndAddpropsSchemaBoxed + + data class ObjectWithPropsAndAddpropsSchemaBoxedMap(val data: FrozenMap) : + ObjectWithPropsAndAddpropsSchemaBoxed { + } + + class ObjectWithPropsAndAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxedMap { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Any?, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsAndAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsAndAddpropsSchema().also { instance = it } + } + } + } + + class ObjectWithOutputTypeSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration) + } + } + } + + interface ObjectWithOutputTypeSchemaBoxed + + data class ObjectWithOutputTypeSchemaBoxedMap(val data: ObjectWithOutputTypeSchemaMap) : + ObjectWithOutputTypeSchemaBoxed { + } + + class ObjectWithOutputTypeSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ObjectWithOutputTypeSchemaMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return ObjectWithOutputTypeSchemaMap(FrozenMap(properties)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithOutputTypeSchemaBoxedMap { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is FrozenMap<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithOutputTypeSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithOutputTypeSchema().also { instance = it } + } + } + } + + @Test + fun testExceptionThrownForInvalidType() { + val schema = ObjectWithPropsSchema.getInstance() + assertFailsWith( + block = { + JsonSchema.validate( + schema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsSchema() { + val schema = ObjectWithPropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithAddpropsSchema() { + val schema = ObjectWithAddpropsSchema.getInstance() + + // map with only property works + var inMap: MutableMap = LinkedHashMap() + inMap["someString"] = "abc" + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = LinkedHashMap() + inMap["someString"] = "abc" + inMap["someOtherString"] = "def" + validatedValue = schema.validate(inMap, configuration) + outMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap) + + // invalid addProp type fails + val invalidInput = java.util.Map.of("someString", 1) + assertFailsWith( + block = { + JsonSchema.validate( + schema, + invalidInput, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsAndAddpropsSchema() { + val schema = ObjectWithPropsAndAddpropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue: Map = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + inMap = mapOf("someString" to 1) + val invalidPropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidPropMap, configuration + ) + } + ) + + // invalid addProp type fails + inMap = LinkedHashMap() + inMap["someAddProp"] = 1 + val invalidAddpropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidAddpropMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithOutputTypeSchema() { + val schema = ObjectWithOutputTypeSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidInMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidInMap, configuration + ) + } + ) + + // using output class directly works + inMap = mapOf("someString" to "abc") + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration) + val outMap2: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap2) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt new file mode 100644 index 00000000000..651d570e7fb --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/RefBooleanSchemaTest.kt @@ -0,0 +1,67 @@ +package org.openapijsonschematools.client.schemas + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.validation.JsonSchema +import org.openapijsonschematools.client.schemas.validation.PathToSchemasMap +import org.openapijsonschematools.client.schemas.validation.ValidationMetadata +import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class RefBooleanSchemaTest { + class RefBooleanSchema { + class RefBooleanSchema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: RefBooleanSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefBooleanSchema1().also { instance = it } + } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = refBooleanJsonSchema.validate(true, configuration) + assertEquals(validatedValue, true) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = refBooleanJsonSchema.validate(false, configuration) + assertEquals(validatedValue, false) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val refBooleanJsonSchema = JsonSchemaFactory.getInstance(RefBooleanSchema.RefBooleanSchema1::class.java) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt new file mode 100644 index 00000000000..c0add8f2b58 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/AdditionalPropertiesValidatorTest.kt @@ -0,0 +1,140 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.MapJsonSchema +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + + +class AdditionalPropertiesValidatorTest { + sealed interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = "def" + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someAddProp") + + val expectedClasses: LinkedHashMap, Nothing?> = LinkedHashMap() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt new file mode 100644 index 00000000000..89993c589f4 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/CustomIsoparserTest.kt @@ -0,0 +1,25 @@ +package org.openapijsonschematools.client.schemas.validation + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime + +import kotlin.test.Test +import kotlin.test.assertEquals + +class CustomIsoparserTest { + @Test + fun testParseIsodatetime() { + val dateTime: ZonedDateTime = CustomIsoparser.parseIsodatetime("2017-07-21T17:32:28Z") + val zone = ZoneId.of("Z") + val expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone) + assertEquals(dateTime, expectedDateTime) + } + + @Test + fun testParseIsodate() { + val date: LocalDate = CustomIsoparser.parseIsodate("2017-07-21") + val expectedDate = LocalDate.of(2017, 7, 21) + assertEquals(date, expectedDate) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt new file mode 100644 index 00000000000..be917b8337c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/FormatValidatorTest.kt @@ -0,0 +1,418 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.IntJsonSchema +import org.openapijsonschematools.client.schemas.Int32JsonSchema +import org.openapijsonschematools.client.schemas.Int64JsonSchema +import org.openapijsonschematools.client.schemas.FloatJsonSchema +import org.openapijsonschematools.client.schemas.DoubleJsonSchema +import org.openapijsonschematools.client.schemas.DecimalJsonSchema +import org.openapijsonschematools.client.schemas.DateJsonSchema +import org.openapijsonschematools.client.schemas.DateTimeJsonSchema + +import java.math.BigDecimal +import java.math.BigInteger +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class FormatValidatorTest { + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithFloat() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testIntFormatFailsWithFloat() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithInt() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInt64UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("-9223372036854775809"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + Long.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt64OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("9223372036854775808"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testFloatUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MAX_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testFloatOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testDoubleUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testDoubleOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInvalidNumberStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidFloatNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidIntNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateTimeStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateTimeStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + companion object { + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt new file mode 100644 index 00000000000..a6fd41ebbd8 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/ItemsValidatorTest.kt @@ -0,0 +1,120 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.schemas.StringJsonSchema +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class ItemsValidatorTest { + interface ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchemaBoxedList : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + return ArrayWithItemsSchemaBoxedList() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectItemsSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add("a") + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value in pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add(0) + val expectedClasses = LinkedHashMap, Nothing?>() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectItemFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add(1) + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt new file mode 100644 index 00000000000..bad1daff26c --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/JsonSchemaTest.kt @@ -0,0 +1,71 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaTest { + internal sealed interface SomeSchemaBoxed + internal class SomeSchemaBoxedString : SomeSchemaBoxed + internal class SomeSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SomeSchemaBoxed { + return SomeSchemaBoxedString() + } + + companion object { + var instance: SomeSchema? = null + get() { + if (field == null) { + field = SomeSchema() + } + return field + } + private set + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val schema = JsonSchemaFactory.getInstance(SomeSchema::class.java) + val pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ) + val expectedPathToSchemas = PathToSchemasMap() + val validatedClasses = LinkedHashMap, Nothing?>() + validatedClasses[schema] = null + expectedPathToSchemas[pathToItem] = validatedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt new file mode 100644 index 00000000000..086c96448e6 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/PropertiesValidatorTest.kt @@ -0,0 +1,123 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + +class PropertiesValidatorTest { + interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(MutableMap::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someString") + val expectedClasses = LinkedHashMap, Nothing?>() + expectedClasses[JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java)] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = 1 + val arg = FrozenMap(mutableMap) + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt new file mode 100644 index 00000000000..ba7af366540 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/RequiredValidatorTest.kt @@ -0,0 +1,110 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class RequiredValidatorTest { + interface ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchemaBoxedMap : ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .required(setOf("someString")) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithRequiredSchemaBoxed { + return ObjectWithRequiredSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["aDifferentProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt new file mode 100644 index 00000000000..c8049c76683 --- /dev/null +++ b/samples/client/3_1_0_unit_test/kotlin/src/test/kotlin/org/openapijsonschematools/client/schemas/validation/TypeValidatorTest.kt @@ -0,0 +1,54 @@ +package org.openapijsonschematools.client.schemas.validation + +import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags +import org.openapijsonschematools.client.configurations.SchemaConfiguration +import org.openapijsonschematools.client.exceptions.ValidationException +import org.openapijsonschematools.client.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class TypeValidatorTest { + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemasMap = validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testValidateFailsIntIsNotString() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + assertFailsWith( + block = { + validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md b/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md index f0f000fa7b2..e0084fbe07c 100644 --- a/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md +++ b/samples/client/3_1_0_unit_test/python/docs/components/schema/non_ascii_pattern_with_additionalproperties.md @@ -19,6 +19,7 @@ Key | Type | Description | Notes ## NonAsciiPatternWithAdditionalpropertiesDict ``` base class: schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES] + ``` ### __new__ method Keyword Argument | Type | Description | Notes diff --git a/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md b/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md index 3b9c58ea6cb..1026ad928fd 100644 --- a/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md +++ b/samples/client/3_1_0_unit_test/python/docs/components/schema/properties_patternproperties_additionalproperties_interaction.md @@ -34,10 +34,7 @@ Key | Type | Description | Notes ## PropertiesPatternpropertiesAdditionalpropertiesInteractionDict ``` -base class: schemas.immutabledict[str, typing.Union[ - typing.Tuple[schemas.OUTPUT_BASE_TYPES], - int, -]] +base class: schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES] ``` ### __new__ method diff --git a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py index 17a3bdf903a..c1a29f44cf9 100644 --- a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py +++ b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/non_ascii_pattern_with_additionalproperties.py @@ -15,6 +15,7 @@ class NonAsciiPatternWithAdditionalpropertiesDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): + __required_keys__: typing.FrozenSet[str] = frozenset({ }) __optional_keys__: typing.FrozenSet[str] = frozenset({ diff --git a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py index 72a898c548a..0e876a03b95 100644 --- a/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py +++ b/samples/client/3_1_0_unit_test/python/src/unit_test_api/components/schema/properties_patternproperties_additionalproperties_interaction.py @@ -52,10 +52,7 @@ def validate( ) -class PropertiesPatternpropertiesAdditionalpropertiesInteractionDict(schemas.immutabledict[str, typing.Union[ - typing.Tuple[schemas.OUTPUT_BASE_TYPES], - int, -]]): +class PropertiesPatternpropertiesAdditionalpropertiesInteractionDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]): __required_keys__: typing.FrozenSet[str] = frozenset({ }) diff --git a/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java b/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java index ef912629dca..fe8292e9a0c 100644 --- a/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java +++ b/src/main/java/org/openapijsonschematools/codegen/common/CodegenConstants.java @@ -220,7 +220,7 @@ public class CodegenConstants { public static enum PARAM_NAMING_TYPE {camelCase, PascalCase, snake_case, original} - public static enum JSON_PATH_LOCATION_TYPE {SCHEMA, REQUEST_BODY, PARAMETER, RESPONSE, HEADER, CONTENT, CONTENT_TYPE, HEADERS, PARAMETERS, RESPONSES, REQUEST_BODIES, SCHEMAS, PATHS, PATH, COMPONENTS, OPERATION, SECURITY_SCHEMES, SECURITY_SCHEME, SERVERS, SERVER, API_ROOT_FOLDER, API_PATH, API_TAG, API_PATHS, API_TAGS, SECURITY, SECURITIES, TEST_ROOT} + public static enum JSON_PATH_LOCATION_TYPE {SCHEMA, REQUEST_BODY, PARAMETER, RESPONSE, HEADER, CONTENT, CONTENT_TYPE, HEADERS, PARAMETERS, RESPONSES, REQUEST_BODIES, SCHEMAS, PATHS, PATH, COMPONENTS, OPERATION, SECURITY_SCHEMES, SECURITY_SCHEME, SERVERS, SERVER, API_ROOT_FOLDER, API_PATH, API_TAG, API_PATHS, API_TAGS, SECURITY, SECURITIES, TEST_ROOT, MEDIA_TYPE} public static enum MODEL_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original} diff --git a/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java b/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java index 1372062c08e..8058333cd8f 100644 --- a/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java +++ b/src/main/java/org/openapijsonschematools/codegen/config/CodegenConfigurator.java @@ -161,9 +161,6 @@ public CodegenConfigurator setApiPackage(String apiPackage) { } public CodegenConfigurator setArtifactId(String artifactId) { - if (StringUtils.isNotEmpty(artifactId)) { - addAdditionalProperty(CodegenConstants.ARTIFACT_ID, artifactId); - } generatorSettingsBuilder.withArtifactId(artifactId); return this; } @@ -301,9 +298,6 @@ public CodegenConfigurator setOutputDir(String outputDir) { } public CodegenConfigurator setPackageName(String packageName) { - if (StringUtils.isNotEmpty(packageName)) { - addAdditionalProperty(CodegenConstants.PACKAGE_NAME, packageName); - } generatorSettingsBuilder.withPackageName(packageName); return this; } diff --git a/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java b/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java index cd2557cdc09..b161b2a7977 100644 --- a/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java +++ b/src/main/java/org/openapijsonschematools/codegen/config/GeneratorSettings.java @@ -268,15 +268,9 @@ private GeneratorSettings(Builder builder) { if (isNotEmpty(invokerPackage)) { additional.put("invokerPackage", invokerPackage); } - if (isNotEmpty(packageName)) { - additional.put("packageName", packageName); - } if (isNotEmpty(groupId)) { additional.put("groupId", groupId); } - if (isNotEmpty(artifactId)) { - additional.put("artifactId", artifactId); - } if (isNotEmpty(artifactVersion)) { additional.put("artifactVersion", artifactVersion); } diff --git a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java index 3bf571adaba..575b50ba540 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java +++ b/src/main/java/org/openapijsonschematools/codegen/generatorrunner/DefaultGeneratorRunner.java @@ -366,8 +366,7 @@ private void generateSchema(List files, CodegenSchema schema, String jsonP private void generateFile(Map templateData, String templateName, String outputFilename, List files, boolean shouldGenerate, String skippedByOption) { templateData.putAll(generator.additionalProperties()); - String packageName = generator.generatorSettings().packageName; - templateData.put("packageName", packageName); + templateData.put("packageName", generator.generatorSettings().packageName); templateData.put("generatorSettings", generator.generatorSettings()); try { File written = processTemplateToFile(templateData, templateName, outputFilename, shouldGenerate, skippedByOption); @@ -382,6 +381,7 @@ private void generateFile(Map templateData, String templateName, } } + @Deprecated private void generateFiles(List> processTemplateToFileInfos, boolean shouldGenerate, String skippedByOption, List files) { for (List processTemplateToFileInfo: processTemplateToFileInfos) { Map templateData = (Map) processTemplateToFileInfo.get(0); @@ -1343,7 +1343,9 @@ Map buildSupportFileBundle( CodegenList security) { Map bundle = new HashMap<>(generator.additionalProperties()); + bundle.put("packageName", generator.generatorSettings().packageName); bundle.put("generatorSettings", generator.generatorSettings()); + bundle.put("generatorMetadata", generator.getGeneratorMetadata()); bundle.put("apiPackage", generator.generatorSettings().apiPackage); URL url = URLPathUtils.getServerURL(openAPI, null); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java index 3990dc0bc3f..a0886e46538 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/DefaultGenerator.java @@ -280,7 +280,7 @@ public DefaultGenerator(GeneratorSettings generatorSettings, WorkflowSettings wo Supporting files are those which aren't models, APIs, or docs. These get a different map of data bound to the templates. Supporting files are written once. */ - protected List supportingFiles = new ArrayList<>(); + protected Set supportingFiles = new LinkedHashSet<>(); protected List cliOptions = new ArrayList<>(); protected String removeOperationIdPrefixDelimiter = "_"; protected int removeOperationIdPrefixCount = 1; @@ -663,7 +663,7 @@ public CodeGeneratorSettings generatorSettings() { } @Override - public List supportingFiles() { + public Set supportingFiles() { return supportingFiles; } @@ -2271,6 +2271,11 @@ public CodegenSchema fromSchema(Schema p, String sourceJsonPath, String currentJ } property.mapValueSchema = mapValueSchema; } + if (property.patternProperties != null && !property.patternProperties.isEmpty()) { + for (CodegenSchema prop: property.patternProperties.values()) { + property.mapValueSchema = prop.add(property.mapValueSchema); + } + } if (currentJsonPath != null) { String[] pathPieces = currentJsonPath.split("/"); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java b/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java index c30a963da8e..2945426452a 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/Generator.java @@ -75,7 +75,7 @@ public interface Generator extends OpenApiProcessor, Comparable { List cliOptions(); - List supportingFiles(); + Set supportingFiles(); CodegenKey getKey(String key, String keyType); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java index 701358347fd..1f8e62834e6 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java @@ -133,10 +133,8 @@ public JavaClientGenerator(GeneratorSettings generatorSettings, WorkflowSettings cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC).defaultValue(this.getSourceFolder())); CliOption buildTool = CliOption.newString(CodegenConstants.BUILD_TOOL, CodegenConstants.BUILD_TOOL_DESC); Map buildToolOptions = new LinkedHashMap<>(); - buildToolOptions.putAll(Map.of( - mavenBuildTool, "Use maven", - gradleBuildTool, "Use gradle" - )); + buildToolOptions.put(mavenBuildTool, "Use maven"); + buildToolOptions.put(gradleBuildTool, "Use gradle"); buildTool.setEnum(buildToolOptions); buildTool.setDefault(mavenBuildTool); cliOptions.add(buildTool); diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java new file mode 100644 index 00000000000..5b066048094 --- /dev/null +++ b/src/main/java/org/openapijsonschematools/codegen/generators/KotlinClientGenerator.java @@ -0,0 +1,3576 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapijsonschematools.codegen.generators; + +import com.google.common.base.Strings; +import com.google.common.collect.Sets; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.examples.Example; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.servers.Server; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.openapijsonschematools.codegen.common.CodegenConstants; +import org.openapijsonschematools.codegen.common.ModelUtils; +import org.openapijsonschematools.codegen.config.GeneratorSettings; +import org.openapijsonschematools.codegen.config.WorkflowSettings; +import org.openapijsonschematools.codegen.generators.generatormetadata.FeatureSet; +import org.openapijsonschematools.codegen.generators.generatormetadata.GeneratorLanguage; +import org.openapijsonschematools.codegen.generators.generatormetadata.GeneratorMetadata; +import org.openapijsonschematools.codegen.generators.generatormetadata.GeneratorType; +import org.openapijsonschematools.codegen.generators.generatormetadata.Stability; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.ComponentsFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.DataTypeFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.DocumentationFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.GlobalFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.OperationFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.SchemaFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.SecurityFeature; +import org.openapijsonschematools.codegen.generators.generatormetadata.features.WireFormatFeature; +import org.openapijsonschematools.codegen.generators.models.CliOption; +import org.openapijsonschematools.codegen.generators.models.GeneratedFileType; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenHeader; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenKey; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenKeyType; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenList; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenParameter; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenParametersInfo; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenRefInfo; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenRequestBody; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenResponse; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenSchema; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenSecurityRequirementObject; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenSecurityScheme; +import org.openapijsonschematools.codegen.generators.openapimodels.CodegenServer; +import org.openapijsonschematools.codegen.generators.openapimodels.EnumInfo; +import org.openapijsonschematools.codegen.generators.openapimodels.EnumValue; +import org.openapijsonschematools.codegen.generators.openapimodels.MapBuilder; +import org.openapijsonschematools.codegen.generators.openapimodels.OperationInput; +import org.openapijsonschematools.codegen.generators.openapimodels.OperationInputProvider; +import org.openapijsonschematools.codegen.templating.HandlebarsEngineAdapter; +import org.openapijsonschematools.codegen.templating.SupportingFile; +import org.openapijsonschematools.codegen.templating.TemplatingEngineAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.validation.constraints.NotNull; +import java.io.File; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.Stack; +import java.util.TreeMap; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.openapijsonschematools.codegen.common.StringUtils.camelize; +import static org.openapijsonschematools.codegen.common.StringUtils.escape; + +public class KotlinClientGenerator extends DefaultGenerator implements Generator { + public KotlinClientGenerator(GeneratorSettings generatorSettings, WorkflowSettings workflowSettings) { + super( + generatorSettings, + workflowSettings, + "kotlin", + "org.openapijsonschematools.client", + "openapi-kotlin-client", + "generated-code" + File.separator + "kotlin" + ); + supportingFiles.add(new SupportingFile("build.gradle.hbs", "", "build.gradle.kts").doNotOverwrite()); + supportingFiles.add(new SupportingFile("settings.gradle.hbs", "", "settings.gradle.kts").doNotOverwrite()); + if (this.outputTestFolder.isEmpty()) { + setOutputTestFolder(this.generatorSettings.outputFolder); + } + // Common files + supportingFiles.add(new SupportingFile("README.hbs", "", "README.md").doNotOverwrite()); + supportingFiles.add(new SupportingFile("gitignore.hbs", "", ".gitignore")); + + headersSchemaFragment = "HeadersSchema"; + supportsInheritance = true; + + + cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC).defaultValue(this.getInvokerPackage())); + cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC).defaultValue(this.getGroupId())); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC).defaultValue(ARTIFACT_VERSION_DEFAULT_VALUE)); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_URL, CodegenConstants.ARTIFACT_URL_DESC).defaultValue(this.getArtifactUrl())); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_DESCRIPTION, CodegenConstants.ARTIFACT_DESCRIPTION_DESC).defaultValue(this.getArtifactDescription())); + cliOptions.add(new CliOption(CodegenConstants.SCM_CONNECTION, CodegenConstants.SCM_CONNECTION_DESC).defaultValue(this.getScmConnection())); + cliOptions.add(new CliOption(CodegenConstants.SCM_DEVELOPER_CONNECTION, CodegenConstants.SCM_DEVELOPER_CONNECTION_DESC).defaultValue(this.getScmDeveloperConnection())); + cliOptions.add(new CliOption(CodegenConstants.SCM_URL, CodegenConstants.SCM_URL_DESC).defaultValue(this.getScmUrl())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_NAME, CodegenConstants.DEVELOPER_NAME_DESC).defaultValue(this.getDeveloperName())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_EMAIL, CodegenConstants.DEVELOPER_EMAIL_DESC).defaultValue(this.getDeveloperEmail())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION, CodegenConstants.DEVELOPER_ORGANIZATION_DESC).defaultValue(this.getDeveloperOrganization())); + cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION_URL, CodegenConstants.DEVELOPER_ORGANIZATION_URL_DESC).defaultValue(this.getDeveloperOrganizationUrl())); + cliOptions.add(new CliOption(CodegenConstants.LICENSE_NAME, CodegenConstants.LICENSE_NAME_DESC).defaultValue(this.getLicenseName())); + cliOptions.add(new CliOption(CodegenConstants.LICENSE_URL, CodegenConstants.LICENSE_URL_DESC).defaultValue(this.getLicenseUrl())); + cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC).defaultValue(this.getSourceFolder())); + cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC)); + cliOptions.add(CliOption.newString(CodegenConstants.PARENT_ARTIFACT_ID, CodegenConstants.PARENT_ARTIFACT_ID_DESC)); + cliOptions.add(CliOption.newString(CodegenConstants.PARENT_VERSION, CodegenConstants.PARENT_VERSION_DESC)); + CliOption snapShotVersion = CliOption.newString(CodegenConstants.SNAPSHOT_VERSION, CodegenConstants.SNAPSHOT_VERSION_DESC); + Map snapShotVersionOptions = new HashMap<>(); + snapShotVersionOptions.put("true", "Use a SnapShot Version"); + snapShotVersionOptions.put("false", "Use a Release Version"); + snapShotVersion.setEnum(snapShotVersionOptions); + cliOptions.add(snapShotVersion); + cliOptions.add(CliOption.newString(TEST_OUTPUT, "Set output folder for models and APIs tests").defaultValue(DEFAULT_TEST_FOLDER)); + + requestBodiesIdentifier = "requestbodies"; + securitySchemesIdentifier = "securityschemes"; + requestBodyIdentifier = "requestbody"; + addSchemaImportsFromV3SpecLocations = true; + deepestRefSchemaImportNeeded = true; + objectIOClassNamePiece = "Map"; + arrayIOClassNamePiece = "List"; + arrayObjectInputClassNameSuffix = "Builder"; + + invokerPackage = "org.openapijsonschematools.client"; + modelPackage = "components.schemas"; + + // cliOptions default redefinition need to be updated + updateOption(CodegenConstants.INVOKER_PACKAGE, this.getInvokerPackage()); + + jsonPathTestTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SCHEMA, + new HashMap<>() {{ + put("src/test/kotlin/packagename/components/schemas/Schema_test.hbs", ".kt"); + }} + ); + } + + private final Logger LOGGER = LoggerFactory.getLogger(KotlinClientGenerator.class); + + protected String authFolder; + protected HashMap schemaJsonPathToModelName = new HashMap<>(); + + private static final String ARTIFACT_VERSION_DEFAULT_VALUE = "1.0.0"; + + public static final String TEST_OUTPUT = "testOutput"; + public static final String DEFAULT_TEST_FOLDER = "${project.build.directory}/generated-test-sources/openapi"; + + protected String invokerPackage = "org.openapijsonschematools"; + protected String groupId = "org.openapijsonschematools"; + protected String artifactVersion = null; + protected String artifactUrl = "https://github.com/openapi-json-schema-tools/openapi-json-schema-generator"; + protected String artifactDescription = "OpenAPI Kotlin"; + protected String developerName = "OpenAPI-Generator Contributors"; + protected String developerEmail = "team@openapijsonschematools.org"; + protected String developerOrganization = "OpenAPITools.org"; + protected String developerOrganizationUrl = "http://openapijsonschematools.org"; + protected String scmConnection = "scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git"; + protected String scmDeveloperConnection = "scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git"; + protected String scmUrl = "https://github.com/openapi-json-schema-tools/openapi-json-schema-generator"; + protected String licenseName = "Unlicense"; + protected String licenseUrl = "http://unlicense.org"; + protected String projectFolder = "src/main"; + // this must not be OS-specific + protected String sourceFolder = projectFolder + "/kotlin"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; + protected String parentGroupId = ""; + protected String parentArtifactId = ""; + protected String parentVersion = ""; + protected String outputTestFolder = ""; + private final Map schemaKeyToModelNameCache = new HashMap<>(); + + private static final FeatureSet featureSet = FeatureSet.newBuilder() + .includeDataTypeFeatures( + DataTypeFeature.Int32, + DataTypeFeature.Int64, + DataTypeFeature.Integer, + DataTypeFeature.Float, + DataTypeFeature.Double, + DataTypeFeature.Number, + DataTypeFeature.String, + DataTypeFeature.Boolean, + DataTypeFeature.Date, + DataTypeFeature.DateTime, + DataTypeFeature.Uuid, + DataTypeFeature.Array, + DataTypeFeature.Object, + DataTypeFeature.Null, + DataTypeFeature.AnyType, + DataTypeFeature.Enum + ) + .includeDocumentationFeatures( + DocumentationFeature.Readme, + DocumentationFeature.Servers, + DocumentationFeature.Security, + DocumentationFeature.ComponentSchemas, + DocumentationFeature.ComponentSecuritySchemes, + DocumentationFeature.ComponentRequestBodies, + DocumentationFeature.ComponentResponses, + DocumentationFeature.ComponentHeaders, + DocumentationFeature.ComponentParameters, + DocumentationFeature.Api + ) + .includeGlobalFeatures( + GlobalFeature.Components, + GlobalFeature.Servers, + GlobalFeature.Security, + GlobalFeature.Paths, + GlobalFeature.Info + ) + .includeComponentsFeatures( + ComponentsFeature.schemas, + ComponentsFeature.securitySchemes, + ComponentsFeature.requestBodies, + ComponentsFeature.responses, + ComponentsFeature.headers, + ComponentsFeature.parameters + ) + .includeSecurityFeatures( + SecurityFeature.ApiKey, + SecurityFeature.HTTP_Basic, + SecurityFeature.HTTP_Bearer + ) + .includeOperationFeatures( + OperationFeature.Security, + OperationFeature.Servers, + OperationFeature.Responses_Default, + OperationFeature.Responses_HttpStatusCode, + OperationFeature.Responses_RangedResponseCodes, + OperationFeature.Responses_RedirectionResponse + ) + .includeSchemaFeatures( + SchemaFeature.AdditionalProperties, + SchemaFeature.AllOf, + SchemaFeature.AnyOf, + SchemaFeature.Const, + SchemaFeature.Contains, + SchemaFeature.Default, + SchemaFeature.DependentRequired, + SchemaFeature.DependentSchemas, + // SchemaFeature.Discriminator, + SchemaFeature.Else, + SchemaFeature.Enum, + SchemaFeature.ExclusiveMaximum, + SchemaFeature.ExclusiveMinimum, + SchemaFeature.Format, + SchemaFeature.If, + SchemaFeature.Items, + SchemaFeature.MaxContains, + SchemaFeature.MaxItems, + SchemaFeature.MaxLength, + SchemaFeature.MaxProperties, + SchemaFeature.Maximum, + SchemaFeature.MinContains, + SchemaFeature.MinItems, + SchemaFeature.MinLength, + SchemaFeature.MinProperties, + SchemaFeature.Minimum, + SchemaFeature.MultipleOf, + SchemaFeature.Not, + SchemaFeature.Nullable, + SchemaFeature.OneOf, + SchemaFeature.Pattern, + SchemaFeature.PatternProperties, + SchemaFeature.PrefixItems, + SchemaFeature.Properties, + SchemaFeature.PropertyNames, + SchemaFeature.Ref, + SchemaFeature.Required, + SchemaFeature.Then, + SchemaFeature.Type, + SchemaFeature.UnevaluatedItems, + SchemaFeature.UnevaluatedProperties, + SchemaFeature.UniqueItems + ) + .includeWireFormatFeatures( + WireFormatFeature.JSON + ) + .build(); + public static final GeneratorMetadata generatorMetadata = GeneratorMetadata.newBuilder() + .name("kotlin") + .language(GeneratorLanguage.KOTLIN) + .languageVersion("1.9.23") + .type(GeneratorType.CLIENT) + .stability(Stability.EXPERIMENTAL) + .featureSet(featureSet) + .generationMessage(String.format(Locale.ROOT, "OpenAPI JSON Schema Generator: %s (%s)", "kotlin", GeneratorType.CLIENT)) + .helpMsg(String.join( + "
", + "Generates a Kotlin client library", + "", + "Features in this generator:", + "- v3.0.0 - [v3.1.0](#schema-feature) OpenAPI Specification support", + "- Very thorough documentation generated in the style of javadocs", + "- Input types constrained for a Schema in SomeSchema.validate", + " - validate method can accept arbitrary List/Map/null/int/long/double/float/String json data", + "- Immutable List output classes generated and returned by validate for List<?> input", + "- Immutable Map output classes generated and returned by validate for Map<?, ?> input", + "- Strictly typed list input can be instantiated in client code using generated ListBuilders", + "- Strictly typed map input can be instantiated in client code using generated MapBuilders", + " - Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:", + " - `new MapBuilder().requiredA(\"a\").requiredB(\"b\").build()`", + " - `new MapBuilder().requiredA(\"a\").requiredB(\"b\").optionalProp(\"c\").additionalProperty(\"someAddProp\", \"d\").build()`", + "- Run time type checking and validation when", + " - validating schema payloads", + " - instantiating List output class (validation run)", + " - instantiating Map output class (validation run)", + " - Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class", + "- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods", + "- Invalid (in Kotlin) property names supported like `class`, `1var`, `hi-there` etc in", + " - component schema names", + " - schema property names (a fallback setter is written in the MapBuilder)", + "- Generated interfaces are largely consistent with the python code", + "- Openapi spec inline schemas supported at any depth in any location", + "- Format support for: int32, int64, float, double, date, datetime, uuid", + "- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string", + "- enum types are generated for enums of type string/integer/number/boolean/null", + "- String transmission of numbers supported with type: string, format: number" + )) + .postGenerationMsg(defaultPostGenerationMsg) + .reservedWords( + getLowerCaseWords( + // includes reserved words at https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java + // and keywords from https://kotlinlang.org/docs/reference/keyword-reference.html + Arrays.asList( + "ApiResponse", + "abstract", + "actual", + "annotation", + "as", + "break", + "class", + "companion", + "const", + "constructor", + "continue", + "contract", + "crossinline", + "data", + "delegate", + "do", + "dynamic", + "else", + "enum", + "expect", + "external", + "false", + "field", + "final", + "finally", + "for", + "fun", + "if", + "import", + "in", + "infix", + "init", + "inline", + "inner", + "interface", + "internal", + "is", + "it", + "lateinit", + "noinline", + "null", + "object", + "open", + "operator", + "out", + "override", + "package", + "param", + "private", + "property", + "protected", + "public", + "receiver", + "reified", + "return", + "sealed", + "setparam", + "super", + "suspend", + "tailrec", + "this", + "throw", + "true", + "try", + "typealias", + "typeof", + "val", + "value", + "var", + "vararg", + "when", + "where", + "while", + "toString" // Map method + ) + ) + ) + .instantiationTypes( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("object", "FrozenMap"), + new AbstractMap.SimpleEntry<>("array", "FrozenList"), + new AbstractMap.SimpleEntry<>("string", "String"), + new AbstractMap.SimpleEntry<>("number", "Number (Int, Long, Float, Double)"), + new AbstractMap.SimpleEntry<>("integer", "Number (Int, Long, Float with integer values, Double with integer values)"), + new AbstractMap.SimpleEntry<>("boolean", "Boolean"), + new AbstractMap.SimpleEntry<>("null", "Nothing? (null)") + ) + ) + .languageSpecificPrimitives( + Sets.newHashSet( + "String", + "Boolean", + "Double", + "Int", + "Long", + "Float", + "Map", + "List", + "Any", + "Nothing" + ) + ) + .build(); + + @Override + public GeneratorMetadata getGeneratorMetadata() { + return generatorMetadata; + } + + @Override + public String toModuleFilename(String name, String jsonPath) { + String usedName = sanitizeName(name, "[^a-zA-Z0-9]+"); + // todo check if empty and if so them use enum name + // todo fix this, this does not handle names starting with numbers + usedName = usedName.toLowerCase(Locale.ROOT); + if (usedName.isEmpty()) { + usedName = toEnumVarName(name, null).toLowerCase(Locale.ROOT); + } + return usedName; + } + + protected void updateServersFilepath(String[] pathPieces) { + String[] copiedPathPieces = pathPieces.clone(); + copiedPathPieces[0] = "#"; + String jsonPath = String.join("/", copiedPathPieces); + if (pathPieces.length == 2) { + // #/servers + pathPieces[1] = "RootServerInfo"; + } else if (pathPieces.length == 3) { + // #/servers/0 + pathPieces[2] = getFilename(CodegenKeyType.SERVER, pathPieces[2], jsonPath); + } else { + // #/servers/0/variables + pathPieces[2] = getFilename(CodegenKeyType.SERVER, pathPieces[2], jsonPath).toLowerCase(Locale.ROOT); + pathPieces[3] = getFilename(CodegenKeyType.SCHEMA, pathPieces[pathPieces.length-1], jsonPath); + } + } + + public String packagePath() { + return "src" + File.separatorChar + "main" + File.separatorChar + "kotlin" + File.separatorChar + generatorSettings.packageName.replace('.', File.separatorChar); + } + + protected String testPackagePath() { + return "src" + File.separatorChar + "test" + File.separatorChar + "kotlin" + File.separatorChar + generatorSettings.packageName.replace('.', File.separatorChar); + } + + @Override + public void processOpts() { + if (StringUtils.isEmpty(System.getenv("KOTLIN_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable KOTLIN_POST_PROCESS_FILE not defined so the Kotlin code may not be properly formatted. To define it, try 'export KOTLIN_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); + LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); + } + + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + } else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { + // guess from api package + String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.API_PACKAGE)); + this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage); + this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + LOGGER.info("Invoker Package Name, originally not set, is now derived from api package name: {}", derivedInvokerPackage); + } else { + //not set, use default to be passed to template + additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); + } + + if (!additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { + additionalProperties.put(CodegenConstants.API_PACKAGE, generatorSettings().apiPackage); + } + + if (additionalProperties.containsKey(CodegenConstants.GROUP_ID)) { + this.setGroupId((String) additionalProperties.get(CodegenConstants.GROUP_ID)); + } else { + //not set, use to be passed to template + additionalProperties.put(CodegenConstants.GROUP_ID, groupId); + } + + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_URL)) { + this.setArtifactUrl((String) additionalProperties.get(CodegenConstants.ARTIFACT_URL)); + } else { + additionalProperties.put(CodegenConstants.ARTIFACT_URL, artifactUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_DESCRIPTION)) { + this.setArtifactDescription((String) additionalProperties.get(CodegenConstants.ARTIFACT_DESCRIPTION)); + } else { + additionalProperties.put(CodegenConstants.ARTIFACT_DESCRIPTION, artifactDescription); + } + + if (additionalProperties.containsKey(CodegenConstants.SCM_CONNECTION)) { + this.setScmConnection((String) additionalProperties.get(CodegenConstants.SCM_CONNECTION)); + } else { + additionalProperties.put(CodegenConstants.SCM_CONNECTION, scmConnection); + } + + if (additionalProperties.containsKey(CodegenConstants.SCM_DEVELOPER_CONNECTION)) { + this.setScmDeveloperConnection((String) additionalProperties.get(CodegenConstants.SCM_DEVELOPER_CONNECTION)); + } else { + additionalProperties.put(CodegenConstants.SCM_DEVELOPER_CONNECTION, scmDeveloperConnection); + } + + if (additionalProperties.containsKey(CodegenConstants.SCM_URL)) { + this.setScmUrl((String) additionalProperties.get(CodegenConstants.SCM_URL)); + } else { + additionalProperties.put(CodegenConstants.SCM_URL, scmUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_NAME)) { + this.setDeveloperName((String) additionalProperties.get(CodegenConstants.DEVELOPER_NAME)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_NAME, developerName); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_EMAIL)) { + this.setDeveloperEmail((String) additionalProperties.get(CodegenConstants.DEVELOPER_EMAIL)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_EMAIL, developerEmail); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_ORGANIZATION)) { + this.setDeveloperOrganization((String) additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION, developerOrganization); + } + + if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_ORGANIZATION_URL)) { + this.setDeveloperOrganizationUrl((String) additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION_URL)); + } else { + additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, developerOrganizationUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.LICENSE_NAME)) { + this.setLicenseName((String) additionalProperties.get(CodegenConstants.LICENSE_NAME)); + } else { + additionalProperties.put(CodegenConstants.LICENSE_NAME, licenseName); + } + + if (additionalProperties.containsKey(CodegenConstants.LICENSE_URL)) { + this.setLicenseUrl((String) additionalProperties.get(CodegenConstants.LICENSE_URL)); + } else { + additionalProperties.put(CodegenConstants.LICENSE_URL, licenseUrl); + } + + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { + this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); + } + additionalProperties.put(CodegenConstants.SOURCE_FOLDER, sourceFolder); + + if (additionalProperties.containsKey(CodegenConstants.PARENT_GROUP_ID)) { + this.setParentGroupId((String) additionalProperties.get(CodegenConstants.PARENT_GROUP_ID)); + } + + if (additionalProperties.containsKey(CodegenConstants.PARENT_ARTIFACT_ID)) { + this.setParentArtifactId((String) additionalProperties.get(CodegenConstants.PARENT_ARTIFACT_ID)); + } + + if (additionalProperties.containsKey(CodegenConstants.PARENT_VERSION)) { + this.setParentVersion((String) additionalProperties.get(CodegenConstants.PARENT_VERSION)); + } + + if (!StringUtils.isEmpty(parentGroupId) && !StringUtils.isEmpty(parentArtifactId) && !StringUtils.isEmpty(parentVersion)) { + additionalProperties.put("parentOverridden", true); + } + + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + this.sanitizeConfig(); + + if (additionalProperties.containsKey(TEST_OUTPUT)) { + setOutputTestFolder(additionalProperties.get(TEST_OUTPUT).toString()); + } + + additionalProperties.put(CodegenConstants.PACKAGE_NAME, generatorSettings.packageName); + List schemaSupportingFiles = new ArrayList<>(); + schemaSupportingFiles.add("AnyTypeJsonSchema"); + schemaSupportingFiles.add("BooleanJsonSchema"); + schemaSupportingFiles.add("DateJsonSchema"); + schemaSupportingFiles.add("DateTimeJsonSchema"); + schemaSupportingFiles.add("DecimalJsonSchema"); + schemaSupportingFiles.add("DoubleJsonSchema"); + schemaSupportingFiles.add("FloatJsonSchema"); + schemaSupportingFiles.add("GenericBuilder"); + schemaSupportingFiles.add("Int32JsonSchema"); + schemaSupportingFiles.add("Int64JsonSchema"); + schemaSupportingFiles.add("IntJsonSchema"); + schemaSupportingFiles.add("ListJsonSchema"); + schemaSupportingFiles.add("MapJsonSchema"); + schemaSupportingFiles.add("NotAnyTypeJsonSchema"); + schemaSupportingFiles.add("NullJsonSchema"); + schemaSupportingFiles.add("NumberJsonSchema"); + schemaSupportingFiles.add("StringJsonSchema"); + schemaSupportingFiles.add("UnsetAddPropsSetter"); + schemaSupportingFiles.add("UuidJsonSchema"); + for (String schemaSupportingFile: schemaSupportingFiles) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/schemas/"+schemaSupportingFile+".hbs", + packagePath() + File.separatorChar + "schemas", + schemaSupportingFile + ".kt")); + } + // tests + List schemaTestSupportingFiles = new ArrayList<>(); + schemaTestSupportingFiles.add("AnyTypeSchemaTest"); + schemaTestSupportingFiles.add("ArrayTypeSchemaTest"); + schemaTestSupportingFiles.add("BooleanSchemaTest"); + schemaTestSupportingFiles.add("ListBuilderTest"); + schemaTestSupportingFiles.add("ListSchemaTest"); + schemaTestSupportingFiles.add("MapSchemaTest"); + schemaTestSupportingFiles.add("NullSchemaTest"); + schemaTestSupportingFiles.add("NumberSchemaTest"); + schemaTestSupportingFiles.add("ObjectTypeSchemaTest"); + schemaTestSupportingFiles.add("RefBooleanSchemaTest"); + for (String schemaTestSupportingFile: schemaTestSupportingFiles) { + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/schemas/"+schemaTestSupportingFile+".hbs", + testPackagePath() + File.separatorChar + "schemas", + schemaTestSupportingFile + ".kt")); + } + + // validation + List keywordValidatorFiles = new ArrayList<>(); + keywordValidatorFiles.add("AdditionalPropertiesValidator"); + keywordValidatorFiles.add("AllOfValidator"); + keywordValidatorFiles.add("AnyOfValidator"); + keywordValidatorFiles.add("BooleanEnumValidator"); + keywordValidatorFiles.add("BooleanSchemaValidator"); + keywordValidatorFiles.add("BooleanValueMethod"); + keywordValidatorFiles.add("ConstValidator"); + keywordValidatorFiles.add("ContainsValidator"); + keywordValidatorFiles.add("BigDecimalValidator"); + keywordValidatorFiles.add("CustomIsoparser"); + keywordValidatorFiles.add("DefaultValueMethod"); + keywordValidatorFiles.add("DependentRequiredValidator"); + keywordValidatorFiles.add("DependentSchemasValidator"); + keywordValidatorFiles.add("DoubleEnumValidator"); + keywordValidatorFiles.add("DoubleValueMethod"); + keywordValidatorFiles.add("ElseValidator"); + keywordValidatorFiles.add("EnumValidator"); + keywordValidatorFiles.add("ExclusiveMaximumValidator"); + keywordValidatorFiles.add("ExclusiveMinimumValidator"); + keywordValidatorFiles.add("FloatEnumValidator"); + keywordValidatorFiles.add("FloatValueMethod"); + keywordValidatorFiles.add("FormatValidator"); + keywordValidatorFiles.add("FrozenList"); + keywordValidatorFiles.add("FrozenMap"); + keywordValidatorFiles.add("IfValidator"); + keywordValidatorFiles.add("IntegerEnumValidator"); + keywordValidatorFiles.add("IntegerValueMethod"); + keywordValidatorFiles.add("ItemsValidator"); + keywordValidatorFiles.add("JsonSchema"); + keywordValidatorFiles.add("JsonSchemaFactory"); + keywordValidatorFiles.add("JsonSchemaInfo"); + keywordValidatorFiles.add("KeywordEntry"); + keywordValidatorFiles.add("KeywordValidator"); + keywordValidatorFiles.add("LengthValidator"); + keywordValidatorFiles.add("ListSchemaValidator"); + keywordValidatorFiles.add("LongEnumValidator"); + keywordValidatorFiles.add("LongValueMethod"); + keywordValidatorFiles.add("MapSchemaValidator"); + keywordValidatorFiles.add("MapUtils"); + keywordValidatorFiles.add("MaxContainsValidator"); + keywordValidatorFiles.add("MaximumValidator"); + keywordValidatorFiles.add("MaxItemsValidator"); + keywordValidatorFiles.add("MaxLengthValidator"); + keywordValidatorFiles.add("MaxPropertiesValidator"); + keywordValidatorFiles.add("MinContainsValidator"); + keywordValidatorFiles.add("MinimumValidator"); + keywordValidatorFiles.add("MinItemsValidator"); + keywordValidatorFiles.add("MinLengthValidator"); + keywordValidatorFiles.add("MinPropertiesValidator"); + keywordValidatorFiles.add("MultipleOfValidator"); + keywordValidatorFiles.add("NotValidator"); + keywordValidatorFiles.add("NullEnumValidator"); + keywordValidatorFiles.add("NullSchemaValidator"); + keywordValidatorFiles.add("NullValueMethod"); + keywordValidatorFiles.add("NumberSchemaValidator"); + keywordValidatorFiles.add("OneOfValidator"); + keywordValidatorFiles.add("PathToSchemasMap"); + keywordValidatorFiles.add("PatternPropertiesValidator"); + keywordValidatorFiles.add("PatternValidator"); + keywordValidatorFiles.add("PrefixItemsValidator"); + keywordValidatorFiles.add("PropertiesValidator"); + keywordValidatorFiles.add("PropertyNamesValidator"); + keywordValidatorFiles.add("RequiredValidator"); + keywordValidatorFiles.add("StringEnumValidator"); + keywordValidatorFiles.add("StringSchemaValidator"); + keywordValidatorFiles.add("StringValueMethod"); + keywordValidatorFiles.add("ThenValidator"); + keywordValidatorFiles.add("TypeValidator"); + keywordValidatorFiles.add("UnevaluatedItemsValidator"); + keywordValidatorFiles.add("UnevaluatedPropertiesValidator"); + keywordValidatorFiles.add("UniqueItemsValidator"); + keywordValidatorFiles.add("UnsetAnyTypeJsonSchema"); + keywordValidatorFiles.add("ValidationData"); + keywordValidatorFiles.add("ValidationMetadata"); + for (String keywordValidatorFile: keywordValidatorFiles) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/schemas/validation/"+keywordValidatorFile+".hbs", + packagePath() + File.separatorChar + "schemas" + File.separatorChar + "validation", + keywordValidatorFile + ".kt")); + } + // tests + List keywordValidatorTestFiles = new ArrayList<>(); + keywordValidatorTestFiles.add("AdditionalPropertiesValidatorTest"); + keywordValidatorTestFiles.add("CustomIsoparserTest"); + keywordValidatorTestFiles.add("FormatValidatorTest"); + keywordValidatorTestFiles.add("ItemsValidatorTest"); + keywordValidatorTestFiles.add("PropertiesValidatorTest"); + keywordValidatorTestFiles.add("RequiredValidatorTest"); + keywordValidatorTestFiles.add("TypeValidatorTest"); + keywordValidatorTestFiles.add("JsonSchemaTest"); + for (String keywordValidatorTestFile: keywordValidatorTestFiles) { + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/schemas/validation/"+keywordValidatorTestFile+".hbs", + testPackagePath() + File.separatorChar + "schemas" + File.separatorChar + "validation", + keywordValidatorTestFile + ".kt")); + } + + // exceptions + List exceptionClasses = new ArrayList<>(); + exceptionClasses.add("BaseException"); + exceptionClasses.add("InvalidAdditionalPropertyException"); + exceptionClasses.add("UnsetPropertyException"); + exceptionClasses.add("ValidationException"); + for (String exceptionClass: exceptionClasses) { + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/"+exceptionClass+".hbs", + packagePath() + File.separatorChar + "exceptions", + exceptionClass + ".kt")); + } + + + // configuration + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs", + packagePath() + File.separatorChar + "configurations", + "JsonSchemaKeywordFlags.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs", + testPackagePath() + File.separatorChar + "configurations", + "JsonSchemaKeywordFlagsTest.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "SchemaConfiguration.kt")); + + // jsonPaths + // requestbodies + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.REQUEST_BODY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.REQUEST_BODY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs", ".md"); + }} + ); + // header + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/headers/Header.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/headers/HeaderDoc.hbs", ".md"); + }} + ); + // parameter + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/parameter/Parameter.hbs", ".kt"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/Parameters.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs", ".md"); + }} + ); + // responses + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSE, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/responses/Response.hbs", ".kt"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/Responses.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs", ".md"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSE, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/responses/ResponseDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs", ".kt"); + }} + ); + // operation + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.OPERATION, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/Operation.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.OPERATION, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs", ".md"); + }} + ); + // path + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.PATH, + new HashMap<>() {{ + put("src/main/kotlin/packagename/paths/path/PathItem.hbs", ".kt"); + }} + ); + // apis + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_PATH, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/paths/Api.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_PATH, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/paths/ApiDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_TAG, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/tags/Api.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.API_TAG, + new HashMap<>() {{ + put("src/main/kotlin/packagename/apis/tags/ApiDoc.hbs", ".md"); + }} + ); + + // schema + HashMap schemaTemplates = new HashMap<>(); + schemaTemplates.put("src/main/kotlin/packagename/components/schemas/Schema.hbs", ".kt"); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SCHEMA, + schemaTemplates + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SCHEMA, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/schemas/Schema_doc.hbs", ".md"); + }} + ); + + super.processOpts(); + + authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); + } + + @Override + public void postProcessModelProperty(CodegenSchema model, CodegenSchema property) { + super.postProcessModelProperty(model, property); + } + + @Override + public Map postProcessSupportingFileData(Map data) { + generateYAMLSpecFile(data); + return super.postProcessSupportingFileData(data); + } + + @Override + public String toApiVarName(String name) { + String apiVarName = super.toApiVarName(name); + if (getGeneratorMetadata().getReservedWords().contains(apiVarName)) { + apiVarName = escapeReservedWord(apiVarName); + } + return apiVarName; + } + + @Override + public String defaultTemplatingEngine() { + return "handlebars"; + } + + @Override + public TemplatingEngineAdapter getTemplatingEngine() { + TemplatingEngineAdapter te = super.getTemplatingEngine(); + HandlebarsEngineAdapter hea = (HandlebarsEngineAdapter) te; + hea.infiniteLoops(true); + hea.setPrettyPrint(true); + return hea; + } + + @Override + public String toModelFilename(String name, String jsonPath) { + return toModelName(name, jsonPath); + } + + @Override + @SuppressWarnings("static-method") + public String sanitizeName(String name, String filterOutRegex) { + return name.replaceAll(filterOutRegex, ""); + } + + protected boolean isValid(String name) { + boolean isValid = super.isValid(name); + if (!isValid) { + return false; + } + return name.matches("^[a-zA-Z]\\w*$"); + } + + protected String getCamelCaseName(String key) { + String usedName = toEnumVarName(key, new StringSchema()); + if (!isValid(usedName)) { + usedName = "set_" + usedName; + } + usedName = camelize(usedName.toLowerCase(Locale.ROOT), true); + return usedName; + } + + @Override + public String escapeUnsafeCharacters(String value) { + // handles escape characters and the like + String stringValue = value; + String backslash = "\\"; + if (stringValue.contains(backslash)) { + stringValue = stringValue.replace(backslash, "\\\\"); + } + String nullChar = "\0"; + if (stringValue.contains(nullChar)) { + stringValue = stringValue.replace(nullChar, "\\u0000"); + } + String doubleQuoteChar = "\""; + if (stringValue.contains(doubleQuoteChar)) { + stringValue = stringValue.replace(doubleQuoteChar, "\\\""); + } + String lineSep = System.lineSeparator(); + if (stringValue.contains(lineSep)) { + stringValue = stringValue.replace(lineSep, "\\n"); + } + String carriageReturn = "\r"; + if (stringValue.contains(carriageReturn)) { + stringValue = stringValue.replace(carriageReturn, "\\r"); + } + String tab = "\t"; + if (stringValue.contains(tab)) { + stringValue = stringValue.replace(tab, "\\t"); + } + String formFeed = "\f"; + if (stringValue.contains(formFeed)) { + stringValue = stringValue.replace(formFeed, "\\u000C"); + } + String dollarSign = "$"; + if (stringValue.contains(dollarSign)) { + stringValue = stringValue.replace(dollarSign, "\\$"); + } + return stringValue; + } + + private String getSchemaPascalCaseName(String name, @NotNull String sourceJsonPath, boolean useCache) { + String usedKey = escapeUnsafeCharacters(name); + usedKey = sanitizeName(usedKey, "[^a-zA-Z0-9_]+"); + /* + schemas named Schema can collide in: + response headers + operation: + HeaderParameters + PathParameters + QueryParameters + CookieParameter + To prevent that, those schemas are renamed + - component responses contain headers + - those headers are collected into a json object schema + - header schemas could also be refed + - so all header schemas must be named by their header name to prevent collisions + */ + String[] pathPieces = sourceJsonPath.split("/"); + + + String lastFragment = pathPieces[pathPieces.length-1]; + boolean operationParametersSchema = (sourceJsonPath.startsWith("#/paths/") && xParameters.contains(lastFragment) && xParameters.contains(name)); + boolean serverVariables = (lastFragment.equals("variables") && Set.of(4,6,7).contains(pathPieces.length) && name.equals("variables")); + if (sourceJsonPath.endsWith("/schema")) { + if (sourceJsonPath.startsWith("#/paths") && sourceJsonPath.contains("/parameters/")) { + if (pathPieces[3].equals("parameters")) { + // #/paths/path/parameters/0/Schema -> PathParamSchema0 + usedKey = "RouteParam" + camelize(usedKey) + pathPieces[4]; // RouteParamSchema0 + } else { + // #/paths/path/get/parameters/0/Schema -> Schema0 + usedKey = camelize(usedKey) + pathPieces[5]; // Schema0 + } + } else if ( + (sourceJsonPath.startsWith("#/paths") && sourceJsonPath.contains("/headers/")) || + sourceJsonPath.startsWith("#/components/headers/") || + (sourceJsonPath.startsWith("#/components/responses/") && sourceJsonPath.contains("/headers/")) + ) { + if (pathPieces[2].equals("headers")) { + // #/components/headers/someHeader/schema -> SomeHeaderSchema + String headerFragment = pathPieces[3]; + usedKey = camelize(headerFragment)+ camelize(usedKey); + } else if (sourceJsonPath.startsWith("#/components/responses/") && sourceJsonPath.contains("/headers/")) { + // #/components/responses/SomeResponse/headers/someHeader/schema + String headerFragment = pathPieces[5]; + usedKey = camelize(headerFragment) + camelize(usedKey); + } else { + // #/paths/path/verb/responses/SomeResponse/headers/someHeader/schema + String headerFragment = pathPieces[7]; + usedKey = camelize(headerFragment)+ camelize(usedKey); + } + } else if (pathPieces[pathPieces.length-3].equals("content")) { + // #/requestBodies/SomeRequestBody/content/application-json/schema + String contentTypeFragment = pathPieces[pathPieces.length-2]; + String prefix = ModelUtils.decodeSlashes(contentTypeFragment); + prefix = sanitizeName(prefix, "[^a-zA-Z0-9]+"); + prefix = camelize(prefix); + usedKey = prefix + camelize(usedKey); + } + } else if (sourceJsonPath.endsWith(headersSchemaFragment) && pathPieces[pathPieces.length-3].equals("responses")) { + // #/components/responses/SomeResponse/HeadersSchema + // #/paths/path/verb/responses/200/HeadersSchema + String responseJsonPath = String.join("/", Arrays.copyOfRange(pathPieces, 0, pathPieces.length-1)); + String responseFragment = pathPieces[pathPieces.length-2]; + String pascalCaseResponse = getPascalCase(CodegenKeyType.RESPONSE, responseFragment, responseJsonPath); + usedKey = pascalCaseResponse + camelize(usedKey); + } else if (operationParametersSchema) { + String prefix = getPathClassNamePrefix(sourceJsonPath); + usedKey = prefix + lastFragment; + } else if (serverVariables) { + if (pathPieces.length == 4) { + // #/servers/0/variables -> 4 + usedKey = "RootServer" + pathPieces[2] + "Variables"; + } else if (pathPieces.length == 6) { + // #/paths/somePath/servers/0/variables -> 6 + CodegenKey pathKey = getKey(ModelUtils.decodeSlashes(pathPieces[2]), "paths", sourceJsonPath); + usedKey = pathKey.pascalCase + "Server" + pathPieces[4] + "Variables"; + } else { + // #/paths/somePath/get/servers/0/variables -> 7 + String prefix = getPathClassNamePrefix(sourceJsonPath); + usedKey = prefix + "Server" + pathPieces[5] + "Variables"; + } + } + HashMap keyToQty = sourceJsonPathToKeyToQty.getOrDefault(sourceJsonPath, new HashMap<>()); + if (useCache) { + if (!sourceJsonPathToKeyToQty.containsKey(sourceJsonPath)) { + sourceJsonPathToKeyToQty.put(sourceJsonPath, keyToQty); + } + } + // starts with number + if (usedKey.matches("^\\d.*")) { + LOGGER.warn("{} (component name starts with number) cannot be used as name. Renamed to Schema{}", usedKey, usedKey); + usedKey = "Schema" + usedKey; // 200 -> Schema200 + } + + usedKey = camelize(usedKey); + + // handle case where usedKey is empty + if (usedKey.isEmpty()) { + // happens with a name like "/" + usedKey = camelize(toEnumVarName(name, null).toLowerCase(Locale.ROOT)); + } + + if (isReservedWord(usedKey)) { + usedKey = usedKey + "Schema"; // e.g. return => ReturnSchema + LOGGER.warn("{} (reserved word) cannot be used as name. Renamed to {}", name, usedKey); + } + + if (useCache) { + Integer qty = keyToQty.getOrDefault(usedKey, 0); + qty += 1; + keyToQty.put(usedKey, qty); + String suffix = ""; + if (qty > 1) { + int schemaNumber = qty-1; + suffix = Integer.toString(schemaNumber); + } + if (qty == 1 && sourceJsonPath.endsWith("/" + name)) { + schemaJsonPathToModelName.put(sourceJsonPath, usedKey); + } + usedKey = usedKey + suffix; + return usedKey; + } + return usedKey; + } + + protected CodegenKey getContainerJsonPathPiece(String expectedComponentType, String currentJsonPath, String sourceJsonPath) { + return getJsonPathPiece(expectedComponentType, currentJsonPath, sourceJsonPath); + } + + private static boolean isInteger(String str) { + if (str == null) { + return false; + } + int length = str.length(); + if (length == 0) { + return false; + } + int i = 0; + if (str.charAt(0) == '-') { + if (length == 1) { + return false; + } + i = 1; + } + for (; i < length; i++) { + char c = str.charAt(i); + if (c < '0' || c > '9') { + return false; + } + } + return true; + } + + private String toSchemaRefClass(String ref, String sourceJsonPath) { + int schemaSuffix = 1; + String[] refPieces = ref.split("/"); + if (ref.equals(sourceJsonPath)) { + // self reference, no import needed + if (ref.startsWith("#/components/schemas/") && refPieces.length == 4) { + return getFilename(CodegenKeyType.SCHEMA, refPieces[refPieces.length-1], ref)+schemaSuffix; + } + Set httpMethods = new HashSet<>(Arrays.asList("post", "put", "patch", "get", "delete", "trace", "options")); + boolean requestBodyCase = ( + refPieces.length == 8 && + refPieces[1].equals("paths") && + httpMethods.contains(refPieces[3]) && + refPieces[4].equals("requestBody") && + refPieces[5].equals("content") && + refPieces[7].equals("schema") + ); + if (requestBodyCase) { + String contentType = ModelUtils.decodeSlashes(refPieces[6]); + // the code knows that content-type are never valid python names + return toVarName(contentType); + } + return null; + } + if (sourceJsonPath != null && ref.startsWith(sourceJsonPath + "/")) { + // internal in-schema reference, no import needed + // TODO handle this in the future + if (getFilePath(GeneratedFileType.CODE, sourceJsonPath).equals(getFilePath(GeneratedFileType.CODE, ref))) { + // TODO ensure that getFilepath returns the same file for somePath/get/QueryParameters + // TODO ensure that getFilepath returns the same file for schemas/SomeSchema... + return null; + } + } + return getFilename(CodegenKeyType.SCHEMA, refPieces[refPieces.length-1], ref)+schemaSuffix; + } + + private String toRequestBodyRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/requestBodies/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toResponseRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/responses/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toHeaderRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/headers/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toParameterRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/parameters/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + private String toSecuritySchemesRefClass(String ref) { + String[] refPieces = ref.split("/"); + if (ref.startsWith("#/components/securitySchemes/") && refPieces.length == 4) { + return toModelName(refPieces[3], ref); + } + return null; + } + + @Override + public String toRefClass(String ref, String sourceJsonPath, String expectedComponentType) { + if (ref == null) { + return null; + } + switch (expectedComponentType) { + case "schemas": + return toSchemaRefClass(ref, sourceJsonPath); + case "requestBodies": + return toRequestBodyRefClass(ref); + case "responses": + return toResponseRefClass(ref); + case "headers": + return toHeaderRefClass(ref); + case "parameters": + return toParameterRefClass(ref); + case "securitySchemes": + return toSecuritySchemesRefClass(ref); + } + return null; + } + + @Override + public String getRefModuleLocation(String ref) { + String filePath = getFilePath(GeneratedFileType.CODE, ref); + String prefix = generatorSettings.outputFolder + File.separatorChar + "src" + File.separatorChar + "main" + File.separatorChar + "kotlin" + File.separatorChar; + // modules are always in a package one above them, so strip off the last jsonPath fragment + String localFilepath = filePath.substring(prefix.length(), filePath.lastIndexOf(File.separatorChar)); + return localFilepath.replaceAll(String.valueOf(File.separatorChar), "."); + } + + @Override + protected boolean needToImport(String type) { + return true; + } + + private Set getDeeperImports(String sourceJsonPath, CodegenSchema schema) { + /* + When a map or list schema contains custom items or properties/additionalProperties + Those output types describe List or Map input types, which may be refs + All of those refs are referenced and Kotlin types are needed because they are defined in inputs + */ + Set imports = new HashSet<>(); + if (schema.jsonPath != null && schema.jsonPath.equals(sourceJsonPath)) { + return imports; + } + if (schema.refInfo != null && schema.refInfo.refModule != null) { + CodegenSchema ref = schema.refInfo.ref; + if (deepestRefSchemaImportNeeded) { + CodegenRefInfo deepestRefInfo = schema.refInfo; + while (deepestRefInfo.ref.refInfo != null) { + deepestRefInfo = deepestRefInfo.ref.refInfo; + } + imports.addAll(getDeeperImports(sourceJsonPath, deepestRefInfo.ref)); + } else { + imports.addAll(getDeeperImports(sourceJsonPath, ref)); + } + // todo remove this when 3.1.0 ref + types is supported + return imports; + } + if (schema.types != null) { + if (schema.types.contains("array")) { + imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenList"); + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + } + if (schema.types.contains("object")) { + imports.add("import "+ generatorSettings.packageName + ".schemas.validation.FrozenMap"); + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + } + } + return imports; + } + + @Override + public Set getImports(String sourceJsonPath, CodegenSchema schema, FeatureSet featureSet) { + Set imports = new HashSet<>(); + // Note: discriminator imports do not need to be added for Kotlin + // because they are in the package namespace in components.schemas + if (schema.allOf != null || schema.anyOf != null || schema.oneOf != null || schema.not != null) { + List allOfs = Collections.emptyList(); + List oneOfs = Collections.emptyList(); + List anyOfs = Collections.emptyList(); + List notSchemas = Collections.emptyList(); + if (schema.allOf != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.AllOf)) { + allOfs = schema.allOf; + } + if (schema.oneOf != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.OneOf)) { + oneOfs = schema.oneOf; + } + if (schema.anyOf != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.AnyOf)) { + anyOfs = schema.anyOf; + } + if (schema.not != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.Not)) { + notSchemas = Collections.singletonList(schema.not); + } + Stream allSchemas = Stream.of( + allOfs.stream(), anyOfs.stream(), oneOfs.stream(), notSchemas.stream()).flatMap(i -> i); + for (CodegenSchema cs: allSchemas.collect(Collectors.toList())) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + // items can exist for AnyType and type array + if (schema.items != null && schema.types != null && schema.types.contains("array")) { + imports.addAll(getImports(sourceJsonPath, schema.items, featureSet)); + } + // additionalProperties can exist for AnyType and type object + if (schema.additionalProperties != null) { + imports.addAll(getImports(sourceJsonPath, schema.additionalProperties, featureSet)); + } + // vars can exist for AnyType and type object + if (schema.properties != null && !schema.properties.isEmpty()) { + for (CodegenSchema cs: schema.properties.values()) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + if (schema.patternProperties != null && !schema.patternProperties.isEmpty()) { + for (CodegenSchema cs: schema.patternProperties.values()) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + if (schema.dependentSchemas != null && !schema.dependentSchemas.isEmpty()) { + for (CodegenSchema cs: schema.dependentSchemas.values()) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + if (schema.unevaluatedItems != null) { + imports.addAll(getImports(sourceJsonPath, schema.unevaluatedItems, featureSet)); + } + if (schema.if_ != null) { + imports.addAll(getImports(sourceJsonPath, schema.if_, featureSet)); + } + if (schema.then != null) { + imports.addAll(getImports(sourceJsonPath, schema.then, featureSet)); + } + if (schema.else_ != null) { + imports.addAll(getImports(sourceJsonPath, schema.else_, featureSet)); + } + if (schema.contains != null) { + imports.addAll(getImports(sourceJsonPath, schema.contains, featureSet)); + } + if (schema.unevaluatedProperties != null) { + imports.addAll(getImports(sourceJsonPath, schema.unevaluatedProperties, featureSet)); + } + if (schema.propertyNames != null) { + imports.addAll(getImports(sourceJsonPath, schema.propertyNames, featureSet)); + } + if (schema.prefixItems != null && !schema.prefixItems.isEmpty()) { + for (CodegenSchema cs: schema.prefixItems) { + imports.addAll(getImports(sourceJsonPath, cs, featureSet)); + } + } + // referenced or inline schemas + if (!sourceJsonPath.startsWith("#/components/schemas/") && schema.refInfo != null && schema.refInfo.refModule != null && featureSet.getSchemaSupportFeatures().contains(SchemaFeature.Ref)) { + imports.add(getImport(schema.refInfo)); + CodegenSchema ref = schema.refInfo.ref; + if (ref.refInfo != null && schema.refInfo.refModule != null && deepestRefSchemaImportNeeded) { + CodegenRefInfo deepestRefInfo = schema.refInfo; + while (deepestRefInfo.ref.refInfo != null) { + deepestRefInfo = deepestRefInfo.ref.refInfo; + } + imports.add(getImport(deepestRefInfo)); + } + } + if (schema.refInfo != null) { + // todo remove this when ref is supported with adjacent properties + return imports; + } + if (schema.types != null) { + if (schema.types.size() == 1) { + if (schema.types.contains("boolean")) { + if (schema.isSimpleBoolean()) { + imports.add("import "+ generatorSettings.packageName + ".schemas.BooleanJsonSchema"); + } else { + addCustomSchemaImports(imports, schema); + addBooleanSchemaImports(imports, schema); + } + } else if (schema.types.contains("null")) { + if (schema.isSimpleNull()) { + imports.add("import "+generatorSettings.packageName + ".schemas.NullJsonSchema"); + } else { + addCustomSchemaImports(imports, schema); + addNullSchemaImports(imports, schema); + } + } else if (schema.types.contains("integer")) { + if (schema.isSimpleInteger()) { + if (schema.format == null || schema.format.equals("int")) { + imports.add("import "+generatorSettings.packageName + ".schemas.IntJsonSchema"); + } else if (schema.format.equals("int32")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema"); + } else if (schema.format.equals("int64")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema"); + } + } else { + addCustomSchemaImports(imports, schema); + addNumberSchemaImports(imports, schema); + } + } else if (schema.types.contains("number")) { + if (schema.isSimpleNumber()) { + if (schema.format == null) { + imports.add("import "+generatorSettings.packageName + ".schemas.NumberJsonSchema"); + } else if (schema.format.equals("int32")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int32JsonSchema"); + } else if (schema.format.equals("int64")) { + imports.add("import "+generatorSettings.packageName + ".schemas.Int64JsonSchema"); + } else if (schema.format.equals("float")) { + imports.add("import "+generatorSettings.packageName + ".schemas.FloatJsonSchema"); + } else if (schema.format.equals("double")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DoubleJsonSchema"); + } + } else { + addCustomSchemaImports(imports, schema); + addNumberSchemaImports(imports, schema); + } + } else if (schema.types.contains("string")) { + if (schema.isSimpleString()) { + if (schema.format == null) { + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema"); + } else if (schema.format.equals("date")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DateJsonSchema"); + } else if (schema.format.equals("date-time")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DateTimeJsonSchema"); + } else if (schema.format.equals("number")) { + imports.add("import "+generatorSettings.packageName + ".schemas.DecimalJsonSchema"); + } else if (schema.format.equals("uuid")) { + imports.add("import "+generatorSettings.packageName + ".schemas.UuidJsonSchema"); + } else if (schema.format.equals("byte")) { + // todo implement this + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema"); + } else if (schema.format.equals("binary")) { + // todo implement this + imports.add("import "+generatorSettings.packageName + ".schemas.StringJsonSchema"); + } + } else { + addCustomSchemaImports(imports, schema); + addStringSchemaImports(imports, schema); + } + } else if (schema.types.contains("object")) { + if (schema.isSimpleObject()) { + imports.add("import "+generatorSettings.packageName + ".schemas.MapJsonSchema"); + // add this in case the 1 higher schema is an array of FrozenMap + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap"); + } else { + addCustomSchemaImports(imports, schema); + addMapSchemaImports(imports, schema); + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + } + } else if (schema.types.contains("array")) { + if (schema.isSimpleArray()) { + imports.add("import "+generatorSettings.packageName + ".schemas.ListJsonSchema"); + // add this in case the 1 higher schema is a map of FrozenList + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList"); + } else { + addCustomSchemaImports(imports, schema); + addListSchemaImports(imports, schema); + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + } + } + } else if (schema.types.size() > 1) { + addCustomSchemaImports(imports, schema); + if (schema.types.contains("string")) { + addStringSchemaImports(imports, schema); + } + if (schema.types.contains("array")) { + addListSchemaImports(imports, schema); + } + if (schema.types.contains("object")) { + addMapSchemaImports(imports, schema); + } + if (schema.types.contains("number") || schema.types.contains("integer")) { + addNumberSchemaImports(imports, schema); + } + if (schema.types.contains("boolean")) { + addBooleanSchemaImports(imports, schema); + } + if (schema.types.contains("null")) { + addNullSchemaImports(imports, schema); + } + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + } + } else { + // no types + if (schema.isBooleanSchemaTrue) { + imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema"); + } else if (schema.isBooleanSchemaFalse) { + imports.add("import "+generatorSettings.packageName + ".schemas.NotAnyTypeJsonSchema"); + } else if (schema.isSimpleAnyType()) { + imports.add("import "+generatorSettings.packageName + ".schemas.AnyTypeJsonSchema"); + // in case higher schema is ListBuilder add List + Map + } else { + addCustomSchemaImports(imports, schema); + imports.add("import java.time.LocalDate"); + imports.add("import java.time.ZonedDateTime"); + imports.add("import java.util.UUID"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.ListSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapSchemaValidator"); + addPropertiesImports(schema, imports); + addRequiredValidator(schema, imports); + addEnumValidator(schema, imports); + addConstImports(schema, imports); + addPatternValidator(schema, imports); + addMultipleOfValidator(schema, imports); + addAdditionalPropertiesImports(schema, imports); + addDefaultValueImport(schema, imports); + addDependentRequiredImports(schema, imports); + addPatternPropertiesImports(schema, imports); + if (schema.mapValueSchema != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.mapValueSchema)); + } + if (schema.items != null) { + imports.addAll(getDeeperImports(sourceJsonPath, schema.items)); + } + if (schema.additionalProperties == null || !schema.additionalProperties.isBooleanSchemaFalse) { + imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException"); + imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException"); + } + } + } + return imports; + } + + private void addPatternValidator(CodegenSchema schema, Set imports) { + if (schema.patternInfo != null) { + imports.add("import java.util.regex.Pattern"); + } + } + + private void addDefaultValueImport(CodegenSchema schema, Set imports) { + if (schema.defaultValue != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DefaultValueMethod"); + } + } + + + private void addEnumValidator(CodegenSchema schema, Set imports) { + if (schema.enumInfo != null) { + if (schema.enumInfo.typeToValues.containsKey("null")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod"); + } + if (schema.enumInfo.typeToValues.containsKey("boolean")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod"); + } + if (schema.enumInfo.typeToValues.containsKey("string")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod"); + } + if (schema.enumInfo.typeToValues.containsKey("Integer")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod"); + } + if (schema.enumInfo.typeToValues.containsKey("Long")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod"); + } + if (schema.enumInfo.typeToValues.containsKey("Float")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod"); + } + if (schema.enumInfo.typeToValues.containsKey("Double")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod"); + } + } + } + + private void addConstImports(CodegenSchema schema, Set imports) { + if (schema.constInfo != null) { + if (schema.constInfo.typeToValues.containsKey("null")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.NullValueMethod"); + } + if (schema.constInfo.typeToValues.containsKey("boolean")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.BooleanValueMethod"); + } + if (schema.constInfo.typeToValues.containsKey("string")) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.StringValueMethod"); + } + if (schema.constInfo.typeToValues.containsKey("Integer")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.IntegerValueMethod"); + } + if (schema.constInfo.typeToValues.containsKey("Long")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.LongValueMethod"); + } + if (schema.constInfo.typeToValues.containsKey("Float")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FloatValueMethod"); + } + if (schema.constInfo.typeToValues.containsKey("Double")) { + imports.add("import java.math.BigDecimal"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleEnumValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.DoubleValueMethod"); + } + } + } + + private void addPropertiesImports(CodegenSchema schema, Set imports) { + if (schema.properties != null) { + imports.add("import " + generatorSettings.packageName + ".exceptions.UnsetPropertyException"); + imports.add("import " + generatorSettings.packageName + ".schemas.GenericBuilder"); + } + } + + private void addPatternPropertiesImports(CodegenSchema schema, Set imports) { + if (schema.patternProperties != null) { + imports.add("import java.util.AbstractMap"); + imports.add("import java.util.regex.Pattern"); + } + } + + private void addDependentRequiredImports(CodegenSchema schema, Set imports) { + if (schema.dependentRequired != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils"); + imports.add("import java.util.AbstractMap"); + } + } + + private void addAdditionalPropertiesImports(CodegenSchema schema, Set imports) { + if (schema.additionalProperties == null || !schema.additionalProperties.isBooleanSchemaFalse) { + imports.add("import "+generatorSettings.packageName + ".exceptions.UnsetPropertyException"); + imports.add("import "+generatorSettings.packageName + ".exceptions.InvalidAdditionalPropertyException"); + } + if (schema.additionalProperties != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.MapUtils"); + } else { + imports.add("import "+generatorSettings.packageName + ".schemas.UnsetAddPropsSetter"); + } + } + + + private void addRequiredValidator(CodegenSchema schema, Set imports) { + if (schema.requiredProperties != null) { + imports.add("import "+generatorSettings.packageName + ".schemas.GenericBuilder"); + } + } + + private void addMultipleOfValidator(CodegenSchema schema, Set imports) { + if (schema.multipleOf != null) { + imports.add("import java.math.BigDecimal"); + } + } + + private void addCustomSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchema"); + imports.add("import " + generatorSettings.packageName + ".schemas.validation.JsonSchemaInfo"); + imports.add("import "+generatorSettings.packageName + ".configurations.SchemaConfiguration"); + imports.add("import "+generatorSettings.packageName + ".exceptions.ValidationException"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.PathToSchemasMap"); // for getNewInstance + imports.add("import "+generatorSettings.packageName + ".schemas.validation.ValidationMetadata"); // for getNewInstance + imports.add("import "+generatorSettings.packageName + ".configurations.JsonSchemaKeywordFlags"); // for getNewInstance + } + + private void addBooleanSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.BooleanSchemaValidator"); + addEnumValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + private void addNullSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.NullSchemaValidator"); + addEnumValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + private void addMapSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.MapSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenMap"); + addRequiredValidator(schema, imports); + addPropertiesImports(schema, imports); + addAdditionalPropertiesImports(schema, imports); + addDependentRequiredImports(schema, imports); + addPatternPropertiesImports(schema, imports); + } + + private void addListSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.ListSchemaValidator"); + imports.add("import "+generatorSettings.packageName + ".schemas.validation.FrozenList"); + } + + private void addNumberSchemaImports(Set imports, CodegenSchema schema) { + imports.add("import " + generatorSettings.packageName + ".schemas.validation.NumberSchemaValidator"); + addEnumValidator(schema, imports); + addMultipleOfValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + private void addStringSchemaImports(Set imports, CodegenSchema schema) { + if (schema.format != null) { + switch (schema.format) { + case "date": + imports.add("import java.time.LocalDate"); + break; + case "date-time": + imports.add("import java.time.ZonedDateTime"); + break; + case "uuid": + imports.add("import java.util.UUID"); + break; + } + } + imports.add("import " + generatorSettings.packageName + ".schemas.validation.StringSchemaValidator"); + addEnumValidator(schema, imports); + addPatternValidator(schema, imports); + addDefaultValueImport(schema, imports); + addConstImports(schema, imports); + } + + + @Override + public String getImport(CodegenRefInfo refInfo) { + String prefix = "import " + generatorSettings.packageName + ".components."; + if (refInfo.ref instanceof CodegenSchema) { + if (refInfo.refModuleAlias == null) { + return "import " + refInfo.refModuleLocation + "." + refInfo.refModule; + } else { + return "import " + refInfo.refModuleLocation + " import " + refInfo.refModule + " as " + refInfo.refModuleAlias; + } + } else if (refInfo.ref instanceof CodegenRequestBody) { + return prefix + "requestbodies." + refInfo.refModule; + } else if (refInfo.ref instanceof CodegenHeader) { + return prefix + "headers." + refInfo.refModule; + } else if (refInfo.ref instanceof CodegenResponse) { + return prefix + "responses." + refInfo.refModule; + } else if (refInfo.ref instanceof CodegenParameter) { + return prefix + "parameters." + refInfo.refModule; + } else if (refInfo.ref instanceof CodegenSecurityScheme) { + return prefix + "securityschemes." + refInfo.refModule; + } + return null; + } + + protected String getModuleLocation(String ref) { + String filePath = getFilePath(GeneratedFileType.CODE, ref); + String prefix = generatorSettings.outputFolder + File.separatorChar + "src" + File.separatorChar + "main" + File.separatorChar + "kotlin" + File.separatorChar; + String localFilepath = filePath.substring(prefix.length()); + return localFilepath.replaceAll(String.valueOf(File.separatorChar), "."); + } + + @Override + public String getFilePath(GeneratedFileType type, String jsonPath) { + if (type != GeneratedFileType.TEST) { + return super.getFilePath(type, jsonPath); + } + String[] pathPieces = jsonPath.split("/"); + pathPieces[0] = generatorSettings.outputFolder + File.separatorChar + testPackagePath(); + if (jsonPath.startsWith("#/components")) { + // #/components/schemas/someSchema + updateComponentsFilepath(pathPieces); + if (pathPieces.length == 4) { + int lastIndex = pathPieces.length - 1; + pathPieces[lastIndex] = pathPieces[lastIndex] + "Test"; + } + } + List finalPathPieces = Arrays.stream(pathPieces) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + return String.join(File.separator, finalPathPieces); + } + + /** + * Return the sanitized variable name for enum + * + * @param value enum variable name + * @param prop property + * @return the sanitized variable name for enum + */ + @Override + public String toEnumVarName(String value, Schema prop) { + // our enum var names are keys in a python dict, so change spaces to underscores + if (value.isEmpty()) { + return "EMPTY"; + } + if (value.equals("null")) { + return "NONE"; + } + + // value is int or float + String intPattern = "^[-+]?\\d+$"; + String floatPattern = "^[-+]?\\d+\\.\\d+$"; + Boolean intMatch = Pattern.matches(intPattern, value); + Boolean floatMatch = Pattern.matches(floatPattern, value); + if (intMatch || floatMatch) { + String plusSign = "^\\+.+"; + String negSign = "^-.+"; + String enumVarName; + if (Pattern.matches(plusSign, value)) { + enumVarName = value.replace("+", "POSITIVE_"); + } else if (Pattern.matches(negSign, value)) { + enumVarName = value.replace("-", "NEGATIVE_"); + } else { + enumVarName = "POSITIVE_" + value; + } + if (floatMatch) { + enumVarName = enumVarName.replace(".", "_PT_"); + } + return enumVarName; + } + + // every character in value is not allowed + String valueWithAllowedCharsOnly = value.replaceAll("^\\W+", ""); + if (valueWithAllowedCharsOnly.isEmpty()) { + StringBuilder usedValueBuilder = new StringBuilder(); + for (int i = 0; i < value.length(); i++){ + char c = value.charAt(i); + String charName = Character.getName(Character.hashCode(c)); + if (usedValueBuilder.length() > 0) { + usedValueBuilder.append("_"); + } + usedValueBuilder.append(charNameToVarName(charName)); + } + return usedValueBuilder.toString(); + } + + String usedValue = value; + // Replace " " with _ + usedValue = usedValue.replaceAll("[ ]+", "_"); + + // replace all invalid characters with their character name descriptions + // replace all invalid characters with their character name descriptions + Stack> matchStartToGroup = new Stack<>(); + Pattern nonLetterCharPattern = Pattern.compile("^[^a-zA-Z]"); + Matcher matcher = nonLetterCharPattern.matcher(usedValue); + while (matcher.find()) { + matchStartToGroup.add(new AbstractMap.SimpleEntry<>(matcher.start(), matcher.group())); + } + Pattern nonWordPattern = Pattern.compile("\\W+"); + matcher = nonWordPattern.matcher(usedValue); + while (matcher.find()) { + if (matcher.start() == 0) { + // skip adding first because it was already added for length 1 only + if (matcher.group().length() == 1) { + continue; + } + matchStartToGroup.add(new AbstractMap.SimpleEntry<>(1, matcher.group().substring(1))); + } else { + matchStartToGroup.add(new AbstractMap.SimpleEntry<>(matcher.start(), matcher.group())); + } + } + char underscore = '_'; + while (!matchStartToGroup.isEmpty()) { + AbstractMap.SimpleEntry entry = matchStartToGroup.pop(); + Integer startIndex = entry.getKey(); + String match = entry.getValue(); + String prefix = ""; + String suffix = ""; + if (startIndex > 0 && usedValue.charAt(startIndex-1) != underscore) { + prefix = "_"; + } + int indexAfter = startIndex + match.length(); + if (startIndex + match.length() < usedValue.length() && usedValue.charAt(indexAfter) != underscore) { + suffix = "_"; + } + StringBuilder convertedMatch = new StringBuilder(); + for (int i = 0; i < match.length(); i++) { + String charName = charNameToVarName(Character.getName(Character.hashCode(match.charAt(i)))); + // todo remove the parens portion of charName here + convertedMatch.append(charName); + if (i != match.length() - 1) { + convertedMatch.append("_"); + } + } + String replacement = prefix + convertedMatch + suffix; + usedValue = usedValue.substring(0, startIndex) + replacement + usedValue.substring(indexAfter); + } + + // add camel case underscore + String regex = "([a-z])([A-Z]+)"; + String regexReplacement = "$1_$2"; + usedValue = usedValue.replaceAll(regex, regexReplacement); + + // uppercase + usedValue = usedValue.toUpperCase(Locale.ROOT); + + if (usedValue.length() > 1) { + // remove trailing _ + usedValue = usedValue.replaceAll("_$", ""); + } + return usedValue; + } + + @Override + public Function> getSchemasFn() { + return codegenSchema -> { + ArrayList schemasBeforeImports = new ArrayList<>(); + ArrayList schemasAfterImports = new ArrayList<>(); + codegenSchema.getAllSchemas(schemasBeforeImports, schemasAfterImports, 0, true); + schemasBeforeImports.addAll(schemasAfterImports); + return schemasBeforeImports; + }; + } + + private void addToTypeToValue(LinkedHashMap> typeToValues, EnumValue enumValue, String type, String name) { + if (!typeToValues.containsKey(type)) { + typeToValues.put(type, new LinkedHashMap<>()); + } + typeToValues.get(type).put(enumValue, name); + } + + protected EnumInfo getEnumInfo(ArrayList values, Schema schema, String currentJsonPath, String sourceJsonPath, LinkedHashSet types, String classSuffix) { + LinkedHashMap enumValueToName = new LinkedHashMap<>(); + LinkedHashMap> typeToValues = new LinkedHashMap<>(); + LinkedHashMap enumNameToValue = new LinkedHashMap<>(); + int truncateIdx = 0; + + if (generatorSettings.removeEnumValuePrefix) { + String commonPrefix = findCommonPrefixOfVars(values); + truncateIdx = commonPrefix.length(); + } + + List xEnumVariableNames = null; + List xEnumDescriptions = null; + // noinspection SpellCheckingInspection + String xEnumVariablenamesKey = "x-enum-varnames"; + String xEnumDescriptionsKey = "x-enum-descriptions"; + if (schema.getExtensions() != null) { + if (schema.getExtensions().containsKey(xEnumVariablenamesKey)) { + xEnumVariableNames = new ArrayList<>(); + Object result = schema.getExtensions().get(xEnumVariablenamesKey); + if (result instanceof List) { + for (Object item: (List) result) { + if (item instanceof String) { + xEnumVariableNames.add((String) item); + } + } + } + } + if (schema.getExtensions().containsKey(xEnumDescriptionsKey)) { + xEnumDescriptions = new ArrayList<>(); + Object result = schema.getExtensions().get(xEnumDescriptionsKey); + if (result instanceof List) { + for (Object item: (List) result) { + if (item instanceof String) { + xEnumDescriptions.add((String) item); + } + } + } + } + } + + int i = 0; + for (Object value : values) { + String description = null; + if (xEnumDescriptions != null && xEnumDescriptions.size() > i) { + description = xEnumDescriptions.get(i); + } + + String enumName; + if (xEnumVariableNames != null && xEnumVariableNames.size() > i) { + enumName = xEnumVariableNames.get(i); + } else { + if (truncateIdx == 0) { + enumName = String.valueOf(value); + } else { + enumName = value.toString().substring(truncateIdx); + if (enumName.isEmpty()) { + enumName = value.toString(); + } + } + } + + String usedName = toEnumVarName(enumName, schema); + EnumValue enumValue = getEnumValue(value, description); + boolean typeIsInteger = enumValue.type.equals("integer"); + boolean intIsNumberUseCase = (typeIsInteger && types!=null && types.contains("number")); + if (types!=null && !types.contains(enumValue.type) && !intIsNumberUseCase) { + throw new RuntimeException("Enum value's type is not allowed by schema types for value="+enumValue.value+" types="+types + " jsonPath="+currentJsonPath); + } + enumValueToName.put(enumValue, usedName); + if (!enumNameToValue.containsKey(usedName)) { + enumNameToValue.put(usedName, enumValue); + } else { + LOGGER.error( + "Enum error: two generated enum variable names collide. The values {} and {} generate variable name {} . Please file an issue at https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/issues", + enumNameToValue.get(usedName).value, + enumValue.value, + usedName); + } + // typeToValues code + if ("null".equals(enumValue.type) || "boolean".equals(enumValue.type) || "string".equals(enumValue.type)) { + addToTypeToValue(typeToValues, enumValue, enumValue.type, usedName); + } else if (value instanceof Integer) { + addToTypeToValue(typeToValues, enumValue, "Integer", usedName); + EnumValue longEnumValue = getEnumValue(Long.parseLong(value.toString()), description); + addToTypeToValue(typeToValues, longEnumValue, "Long", usedName); + EnumValue floatEnumValue = getEnumValue(Float.valueOf(value +".0"), description); + addToTypeToValue(typeToValues, floatEnumValue, "Float", usedName); + EnumValue doubleEnumValue = getEnumValue(Double.valueOf(value +".0"), description); + addToTypeToValue(typeToValues, doubleEnumValue, "Double", usedName); + } else if (value instanceof Long) { + addLongEnum(typeToValues, enumValue, (Long) value, usedName); + } else if (value instanceof Float) { + addToTypeToValue(typeToValues, enumValue, "Float", usedName); + EnumValue doubleEnumValue = getEnumValue(Double.valueOf(value.toString()), description); + addToTypeToValue(typeToValues, doubleEnumValue, "Double", usedName); + } else if (value instanceof Double) { + addDoubleEnum(typeToValues, enumValue, (Double) value, usedName); + } else if (value instanceof BigDecimal) { + BigDecimal casValue = (BigDecimal) value; + boolean isInteger = casValue.signum() == 0 || casValue.scale() <= 0 || casValue.stripTrailingZeros().scale() <= 0; + if (isInteger) { + addLongEnum(typeToValues, enumValue, casValue.longValue(), usedName); + } else { + addDoubleEnum(typeToValues, enumValue, casValue.doubleValue(), usedName); + } + } + i += 1; + } + CodegenKey jsonPathPiece = null; + if (currentJsonPath != null) { + String currentName = currentJsonPath.substring(currentJsonPath.lastIndexOf("/") + 1); + jsonPathPiece = getKey(currentName + classSuffix, "schemaProperty", sourceJsonPath); + } + + return new EnumInfo(enumValueToName, typeToValues, jsonPathPiece); + } + + private void addLongEnum(LinkedHashMap> typeToValues, EnumValue enumValue, Long value, String usedName) { + addToTypeToValue(typeToValues, enumValue, "Long", usedName); + EnumValue doubleEnumValue = getEnumValue(Double.valueOf(value.toString()+".0"), enumValue.description); + addToTypeToValue(typeToValues, doubleEnumValue, "Double", usedName); + if (value >= -2147483648L && value <= 2147483647L) { + EnumValue integerEnumValue = getEnumValue(Integer.valueOf(value.toString()), enumValue.description); + addToTypeToValue(typeToValues, integerEnumValue, "Integer", usedName); + EnumValue floatEnumValue = getEnumValue(Float.valueOf(value +".0"), enumValue.description); + addToTypeToValue(typeToValues, floatEnumValue, "Float", usedName); + } + } + + private void addDoubleEnum(LinkedHashMap> typeToValues, EnumValue enumValue, Double value, String usedName) { + addToTypeToValue(typeToValues, enumValue, "Double", usedName); + if (value >= -3.4028234663852886e+38d && value <= 3.4028234663852886e+38d) { + EnumValue floatEnumValue = getEnumValue(Float.valueOf(value.toString()), enumValue.description); + addToTypeToValue(typeToValues, floatEnumValue, "Float", usedName); + } + } + + protected List> getOperationBuilders(String jsonPath, CodegenRequestBody requestBody, CodegenParametersInfo parametersInfo, CodegenList servers, CodegenList security) { + if (requestBody == null && parametersInfo == null && servers == null && security == null) { + return null; + } + int qtyBuilders = 1; // last one with optional params + int reqPropsSize = 0; + boolean requestBodyExists = requestBody != null; + boolean parametersExist = parametersInfo != null; + List requiredProperties = new ArrayList<>(); + List optionalProperties = new ArrayList<>(); + if (requestBodyExists) { + if (Boolean.TRUE.equals(requestBody.getSelfOrDeepestRef().required)) { + reqPropsSize += 1; + requiredProperties.add(requestBody); + } else { + optionalProperties.add(requestBody); + } + } + if (parametersExist) { + if (parametersInfo.headerParametersSchema != null) { + if (parametersInfo.headerParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.headerParametersSchema); + } else { + optionalProperties.add(parametersInfo.headerParametersSchema); + } + } + if (parametersInfo.pathParametersSchema != null) { + if (parametersInfo.pathParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.pathParametersSchema); + } else { + optionalProperties.add(parametersInfo.pathParametersSchema); + } + } + if (parametersInfo.queryParametersSchema != null) { + if (parametersInfo.queryParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.queryParametersSchema); + } else { + optionalProperties.add(parametersInfo.queryParametersSchema); + } + } + if (parametersInfo.cookieParametersSchema != null) { + if (parametersInfo.cookieParametersSchema.requiredProperties != null) { + reqPropsSize += 1; + requiredProperties.add(parametersInfo.cookieParametersSchema); + } else { + optionalProperties.add(parametersInfo.cookieParametersSchema); + } + } + } + if (servers != null) { + optionalProperties.add(servers); + } + if (security != null) { + optionalProperties.add(security); + } + OperationInput timeout = new OperationInput( + getKey("Duration", "misc"), + "timeout", + null + ); + optionalProperties.add(timeout); + + Map> bitStrToBuilder = new HashMap<>(); + MapBuilder lastBuilder = null; + // builders are built last to first, last builder has build method + String[] pathPieces = jsonPath.split("/"); + CodegenKey operationKey = getKey(pathPieces[pathPieces.length-1], "misc", jsonPath); + String builderName = operationKey.pascalCase; + List> builders = new ArrayList<>(); + if (requiredProperties.size() > 0) { + qtyBuilders = (int) Math.pow(2, requiredProperties.size()); + } + for (int i=0; i < qtyBuilders; i++) { + String bitStr = ""; + if (reqPropsSize != 0) { + bitStr = String.format("%"+reqPropsSize+"s", Integer.toBinaryString(i)).replace(' ', '0'); + } + CodegenKey builderClassName; + if (i == qtyBuilders - 1) { + // first invoked builder has the simplest name with no bitStr + builderClassName = getKey(builderName + "RequestBuilder", "misc", jsonPath); + } else { + builderClassName = getKey(builderName + bitStr + "RequestBuilder", "misc", jsonPath); + } + MapBuilder builder; + if (i == 0) { + builder = new MapBuilder<>(builderClassName, new LinkedHashMap<>()); + lastBuilder = builder; + } else { + LinkedHashMap> keyToBuilder = new LinkedHashMap<>(); + for (int c=0; c < reqPropsSize; c++) { + if (bitStr.charAt(c) == '1') { + StringBuilder nextBuilderBitStr = new StringBuilder(bitStr); + nextBuilderBitStr.setCharAt(c, '0'); + CodegenKey key = getKey(requiredProperties.get(c).operationInputVariableName(), "misc"); + if (key == null) { + throw new RuntimeException("key must exist at c="+c); + } + MapBuilder nextBuilder = bitStrToBuilder.get(nextBuilderBitStr.toString()); + if (nextBuilder == null) { + throw new RuntimeException("Next builder must exist for bitStr="+ nextBuilderBitStr); + } + var pair = new MapBuilder.BuilderPropertyPair<>(nextBuilder, requiredProperties.get(c)); + keyToBuilder.put(key, pair); + } + } + builder = new MapBuilder<>(builderClassName, keyToBuilder); + } + bitStrToBuilder.put(bitStr, builder); + builders.add(builder); + } + // todo add builder that allows + if (!optionalProperties.isEmpty()) { + for (OperationInputProvider property: optionalProperties) { + var pair = new MapBuilder.BuilderPropertyPair<>(lastBuilder, property); + CodegenKey key = getKey(property.operationInputVariableName(), "misc"); + lastBuilder.keyToBuilder.put(key, pair); + } + } + return builders; + } + + private String getPathClassNamePrefix(String jsonPath) { + // #/paths/somePath/get -> SomepathGet + String[] pathPieces = jsonPath.split("/"); + String pathJsonPath = "#/paths/"+pathPieces[2]; + String pathClassName = getFilename(CodegenKeyType.PATH, ModelUtils.decodeSlashes(pathPieces[2]), pathJsonPath); + return pathClassName + StringUtils.capitalize(pathPieces[3]); + } + + @Override + public String getPascalCase(CodegenKeyType type, String lastJsonPathFragment, String jsonPath) { + switch (type) { + case SCHEMA: + return getSchemaPascalCaseName(lastJsonPathFragment, jsonPath, true); + case PATH: + return camelize(getFilename(CodegenKeyType.PATH, lastJsonPathFragment, jsonPath)); + case REQUEST_BODY: + if (jsonPath.startsWith("#/paths")) { + String prefix = getPathClassNamePrefix(jsonPath); + return prefix + "RequestBody"; + } + return toModelName(lastJsonPathFragment, jsonPath); + case MISC: + case HEADER: + case CONTENT_TYPE: + case SECURITY_SCHEME: + return toModelName(lastJsonPathFragment, jsonPath); + case OPERATION: + return getFilename(CodegenKeyType.OPERATION, lastJsonPathFragment, jsonPath); + case PARAMETER: + return getFilename(CodegenKeyType.PARAMETER, lastJsonPathFragment, jsonPath); + case RESPONSE: + if (jsonPath.startsWith("#/components/responses/")) { + return toModelName(lastJsonPathFragment, null); + } else { + String prefix = getPathClassNamePrefix(jsonPath); + if (jsonPath.endsWith("/responses")) { + // #/paths/somePath/get/responses + return prefix + "Responses"; + } + // #/paths/somePath/get/responses/200 + return prefix + "Code" + lastJsonPathFragment + "Response"; + } + case SERVER: + String[] pathPieces = jsonPath.split("/"); + if (jsonPath.startsWith("#/servers")) { + if (pathPieces.length == 2) { + // #/servers + return "RootServerInfo"; + } + // #/servers/0 + return "RootServer"+pathPieces[2]; + } else if (jsonPath.startsWith("#/paths") && pathPieces.length >= 4 && pathPieces[3].equals("servers")) { + CodegenKey pathKey = getKey(ModelUtils.decodeSlashes(pathPieces[2]), "paths", jsonPath); + if (pathPieces.length == 4) { + // #/paths/somePath/servers + return pathKey.pascalCase + "ServerInfo"; + } + // #/paths/somePath/servers/0 + return pathKey.pascalCase + "Server"+ pathPieces[4]; + } + // jsonPath.startsWith("#/paths") && pathPieces.length >= 5 && pathPieces[4].equals("servers") + String prefix = getPathClassNamePrefix(jsonPath); + if (pathPieces.length == 5) { + // #/paths/somePath/get/servers + return prefix + "ServerInfo"; + } + // #/paths/somePath/get/servers/0 + return prefix + "Server" + pathPieces[5]; + case SECURITY: + return getFilename(CodegenKeyType.SECURITY, lastJsonPathFragment, jsonPath); + default: + return null; + } + } + + @Override + public String getFilename(CodegenKeyType type, String lastJsonPathFragment, String jsonPath) { + String[] pathPieces = jsonPath.split("/"); + switch(type) { + case SCHEMA: + String modelName = schemaJsonPathToModelName.get(jsonPath); + if (modelName != null) { + return modelName; + } + return getSchemaPascalCaseName(pathPieces[pathPieces.length-1], jsonPath, false); + case SERVER: + return getPascalCase(CodegenKeyType.SERVER, lastJsonPathFragment, jsonPath); + case SECURITY_SCHEME: + return toModelName(lastJsonPathFragment, jsonPath); + case OPERATION: + String pathJsonPath = "#/paths/"+pathPieces[2]; + String pthClassName = getFilename(CodegenKeyType.PATH, ModelUtils.decodeSlashes(pathPieces[2]), pathJsonPath); + String operationFileName = pthClassName + StringUtils.capitalize(lastJsonPathFragment); + return operationFileName; + case PARAMETER: + if (jsonPath.startsWith("#/components/parameters/")) { + if (pathPieces.length == 4) { + // #/components/parameters/SomeParameter + return toModelName(lastJsonPathFragment, null); + } + return toModuleFilename(lastJsonPathFragment, jsonPath); + } + if (operationVerbs.contains(pathPieces[3])) { + if (pathPieces.length == 5) { + // #/paths/somePath/verb/parameters + return "Parameters"; + } + if (pathPieces[pathPieces.length-2].equals("parameters") && isInteger(lastJsonPathFragment) && pathPieces.length == 6) { + // #/paths/somePath/verb/parameters/0 + return "Parameter" + lastJsonPathFragment; + } + return "parameter" + lastJsonPathFragment; + } + if (pathPieces[pathPieces.length-2].equals("parameters") && isInteger(lastJsonPathFragment) && pathPieces.length == 5) { + // #/paths/somePath/parameters/0 + return "RouteParameter" + lastJsonPathFragment; + } + return "routeparameter" + lastJsonPathFragment; + case PATH: + boolean pathClassCase = (pathPieces.length == 3 || (pathPieces.length == 4 && pathPieces[1].equals("apis"))); + if (pathClassCase) { + // #/paths/somePath -> Somepath + // #/apis/paths/somePath -> Somepath + String moduleFilename = toModuleFilename(lastJsonPathFragment, jsonPath); + return camelize(moduleFilename, false); + } + // #/paths/somePath/blah -> somepath + return toModuleFilename(lastJsonPathFragment, jsonPath); + case HEADER: + if (jsonPath.startsWith("#/components/headers/")) { + if (pathPieces.length == 4) { + // #/components/headers/SomeHeader + return toModelName(lastJsonPathFragment, null); + } + // deeper paths + return toModuleFilename(lastJsonPathFragment, jsonPath); + } else if (jsonPath.startsWith("#/components/responses/")) { + if (pathPieces.length == 5) { + // #/components/responses/SomeResponse/headers + return "Headers"; + } else if (pathPieces.length == 6) { + // #/components/responses/SomeResponse/headers/SomeHeader + return toModelName(lastJsonPathFragment, null); + } + // deeper paths + return toModuleFilename(lastJsonPathFragment, jsonPath); + } + if (pathPieces.length == 7) { + // #/paths/somePath/verb/responses/200/headers + return "Headers"; + } else if (pathPieces.length == 8) { + // #/paths/somePath/verb/responses/200/headers/SomeHeader + return toModelName(lastJsonPathFragment, null); + } + // deeper paths + return toModuleFilename(lastJsonPathFragment, jsonPath); + case REQUEST_BODY: + if (pathPieces[2].equals("requestbodies") || pathPieces[2].equals("requestBodies")) { + if (pathPieces.length == 4) { + // #/components/requestBodies/Pet + return toModelName(lastJsonPathFragment, null); + } + return toModuleFilename(lastJsonPathFragment, null); + } + if (pathPieces.length == 5) { + // #/paths/somePath/verb/requestBody + String pathClassName = getPathClassNamePrefix(jsonPath); + return pathClassName + "RequestBody"; + } + return toModuleFilename(lastJsonPathFragment, null); + case CONTENT_TYPE: + return toModuleFilename(lastJsonPathFragment, null); + case SECURITY: + if (pathPieces.length == 2) { + // #/security + return "SecurityInfo"; + } else if (pathPieces.length == 3) { + // #/security/0 + return "SecurityRequirementObject"+pathPieces[pathPieces.length-1]; + } else if (pathPieces.length == 5) { + // #/paths/somePath/verb/security + String prefix = getPathClassNamePrefix(jsonPath); + return prefix + "SecurityInfo"; + } + // pathPieces.length == 6 + // #/paths/somePath/verb/security/0 + String prefix = getPathClassNamePrefix(jsonPath); + return prefix + "SecurityRequirementObject"+pathPieces[pathPieces.length-1]; + case RESPONSE: + if (jsonPath.startsWith("#/components/responses/")) { + if (pathPieces.length == 4) { + // #/components/responses/SomeResponse + return toModelName(lastJsonPathFragment, null); + } + return toModuleFilename(lastJsonPathFragment, jsonPath); + } + String clsNamePrefix = getPathClassNamePrefix(jsonPath); + switch (pathPieces.length) { + case 5: + // #/paths/somePath/verb/responses + return clsNamePrefix + "Responses"; + case 6: + // #/paths/somePath/verb/responses/200 + return clsNamePrefix + "Code"+ lastJsonPathFragment + "Response"; + default: + return toModuleFilename("code"+lastJsonPathFragment+"response", null); + } + default: + return null; + } + } + + protected List> getMapBuilders(CodegenSchema schema, String currentJsonPath, String sourceJsonPath) { + List> builders = new ArrayList<>(); + if (sourceJsonPath == null) { + return builders; + } + String schemaName = currentJsonPath.substring(currentJsonPath.lastIndexOf("/") + 1); + schemaName = ModelUtils.decodeSlashes(schemaName); + int qtyBuilders = 1; + int reqPropsSize = 0; + if (schema.requiredProperties != null) { + qtyBuilders = (int) Math.pow(2, schema.requiredProperties.size()); + reqPropsSize = schema.requiredProperties.size(); + } + Map> bitStrToBuilder = new HashMap<>(); + List reqPropKeys = new ArrayList<>(); + if (schema.requiredProperties != null) { + reqPropKeys.addAll(schema.requiredProperties.keySet()); + } + MapBuilder lastBuilder = null; + // builders are built last to first, last builder has build method + for (int i=0; i < qtyBuilders; i++) { + String bitStr = ""; + if (reqPropsSize != 0) { + bitStr = String.format("%"+reqPropsSize+"s", Integer.toBinaryString(i)).replace(' ', '0'); + } + CodegenKey builderClassName; + if (i == qtyBuilders - 1) { + // first invoked builder has the simplest name with no bitStr + if (schema.mapInputJsonPathPiece != null) { + builderClassName = schema.mapInputJsonPathPiece; + } else { + builderClassName = getKey( + schemaName + objectIOClassNamePiece + "Builder", + "schemas", + sourceJsonPath + ); + } + } else { + builderClassName = getKey( + schemaName + objectIOClassNamePiece + bitStr + "Builder", + "schemas", + sourceJsonPath + ); + } + MapBuilder builder; + if (i == 0) { + builder = new MapBuilder<>(builderClassName, new LinkedHashMap<>()); + lastBuilder = builder; + } else { + LinkedHashMap> keyToBuilder = new LinkedHashMap<>(); + for (int c=0; c < reqPropsSize; c++) { + if (bitStr.charAt(c) == '1') { + StringBuilder nextBuilderBitStr = new StringBuilder(bitStr); + nextBuilderBitStr.setCharAt(c, '0'); + CodegenKey key = reqPropKeys.get(c); + if (key == null) { + throw new RuntimeException("key must exist at c="+c); + } + MapBuilder nextBuilder = bitStrToBuilder.get(nextBuilderBitStr.toString()); + if (nextBuilder == null) { + throw new RuntimeException("Next builder must exist for bitStr="+ nextBuilderBitStr); + } + var pair = new MapBuilder.BuilderPropertyPair<>(nextBuilder, schema.requiredProperties.get(key)); + keyToBuilder.put(key, pair); + } + } + builder = new MapBuilder<>(builderClassName, keyToBuilder); + } + bitStrToBuilder.put(bitStr, builder); + builders.add(builder); + } + if (lastBuilder != null && schema.optionalProperties != null) { + for (Map.Entry entry: schema.optionalProperties.entrySet()) { + var pair = new MapBuilder.BuilderPropertyPair<>(lastBuilder, entry.getValue()); + lastBuilder.keyToBuilder.put(entry.getKey(), pair); + } + } + return builders; + } + + @Override + public TreeMap postProcessAllModels(TreeMap objs) { + objs = super.postProcessAllModels(objs); + objs = super.updateAllModels(objs); + + return objs; + } + + private void sanitizeConfig() { + // Sanitize any config options here. We also have to update the additionalProperties because + // the whole additionalProperties object is injected into the main object passed to the mustache layer + + this.setModelPackage(sanitizePackageName(modelPackage)); + + this.setInvokerPackage(sanitizePackageName(invokerPackage)); + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); + } + } + + @Override + public String escapeReservedWord(String name) { + return "_" + name; + } + + @Override + public String toVarName(String name) { + // sanitize name + name = sanitizeName(name, "\\W-[\\$]"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + + if (name.toLowerCase(Locale.ROOT).matches("^_*class$")) { + return "propertyClass"; + } + + if ("_".equals(name)) { + name = "_u"; + } + + // numbers are not allowed at the beginning + if (name.matches("^\\d.*")) { + name = "_" + name; + } + + // if it's all upper case, do nothing + if (name.matches("^[A-Z0-9_]*$")) { + return name; + } + + if (startsWithTwoUppercaseLetters(name)) { + name = name.substring(0, 2).toLowerCase(Locale.ROOT) + name.substring(2); + } + + // If name contains special chars -> replace them. + if ((((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character))))) { + List allowedCharacters = new ArrayList<>(); + allowedCharacters.add("_"); + allowedCharacters.add("$"); + name = escape(name, specialCharReplacements, allowedCharacters, "_"); + } + + // camelize (lower first character) the variable name + // pet_id => petId + name = camelize(name, true); + + // for reserved word or word starting with number, append _ + if (isReservedWord(name) || name.matches("^\\d.*")) { + name = escapeReservedWord(name); + } + + return name; + } + + private boolean startsWithTwoUppercaseLetters(String name) { + boolean startsWithTwoUppercaseLetters = false; + if (name.length() > 1) { + startsWithTwoUppercaseLetters = name.substring(0, 2).equals(name.substring(0, 2).toUpperCase(Locale.ROOT)); + } + return startsWithTwoUppercaseLetters; + } + + @Override + public String toModelName(final String name, String jsonPath) { + // We need to check if schema-mapping has a different model for this class, so we use it + // instead of the auto-generated one. + + // memoization + if (schemaKeyToModelNameCache.containsKey(name)) { + return schemaKeyToModelNameCache.get(name); + } + + String nameWithPrefixSuffix = sanitizeName(name); + + if (!StringUtils.isEmpty(modelNamePrefix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix; + } + + if (!StringUtils.isEmpty(modelNameSuffix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix; + } + + // camelize the model name + // phone_number => PhoneNumber + final String camelizedName = camelize(nameWithPrefixSuffix); + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(camelizedName)) { + final String modelName = "Model" + camelizedName; + schemaKeyToModelNameCache.put(name, modelName); + LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName); + return modelName; + } + + // model name starts with number + if (camelizedName.matches("^\\d.*")) { + final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) + schemaKeyToModelNameCache.put(name, modelName); + LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name, + modelName); + return modelName; + } + + schemaKeyToModelNameCache.put(name, camelizedName); + + return camelizedName; + } + + /** + * Return the example value of the parameter. Overrides the + * getParameterExampleValue(Parameter) method in + * DefaultGenerator to always call setParameterExampleValue(CodegenParameter) + * in this class, which adds single quotes around strings from the + * x-example property. + * + * @param parameter Parameter + */ + @Override + public String getParameterExampleValue(Parameter parameter) { + String example = null; + if (parameter.getExample() != null) { + example = parameter.getExample().toString(); + } else if (parameter.getExamples() != null && !parameter.getExamples().isEmpty()) { + Example examplesExample = parameter.getExamples().values().iterator().next(); + if (examplesExample.getValue() != null) { + example = examplesExample.getValue().toString(); + } + } + + Schema schema = parameter.getSchema(); + + if (schema == null && parameter.getContent() != null) { + String contentType = (String) parameter.getContent().keySet().toArray()[0]; + schema = parameter.getContent().get(contentType).getSchema(); + } + + if (schema == null) { + return null; + } + + if (schema.getExample() != null) { + example = schema.getExample().toString(); + } else if (schema.getExamples() != null && !schema.getExamples().isEmpty()) { + example = schema.getExamples().get(0).toString(); + } + + boolean hasAllowableValues = schema.getEnum() != null && !schema.getEnum().isEmpty(); + if (hasAllowableValues) { + //support examples for inline enums + final List values = (List) schema.getEnum(); + example = String.valueOf(values.get(0)); + } else if (schema.getDefault() != null) { + example = schema.getDefault().toString(); + } else if (schema.getExample() != null) { + example = schema.getExample().toString(); + } else if (schema.getExamples() != null && !schema.getExamples().isEmpty()) { + example = schema.getExamples().get(0).toString(); + } + + Set types = schema.getTypes(); + if (types == null) { + types = new HashSet<>(); + if (schema.getType() != null) { + types.add(schema.getType()); + } + } + if (types.contains("string")) { + String format = schema.getFormat(); + if (format != null) { + switch (format) { + case "uuid": + if (example == null) { + example = "UUID.randomUUID()"; + } else { + example = "UUID.fromString(\"" + example + "\")"; + } + break; + case "binary": + if (example == null) { + example = "/path/to/file"; + } + example = "new File(\"" + escapeText(example) + "\")"; + break; + case "date": + example = "new Date()"; + break; + case "date-time": + if (example == null) { + example = "LocalDate.now()"; + } else { + example = "LocalDate.parse(\"" + example + "\")"; + } + break; + case "number": + if (example == null) { + example = "new BigDecimal(78)"; + } else { + example = "new BigDecimal(\"" + example + "\")"; + } + break; + } + } else { + if (example == null) { + example = parameter.getName() + "_example"; + } + example = "\"" + escapeText(example) + "\""; + } + } else if (types.contains("integer")) { + if (example == null) { + example = "56"; + } + if (schema.getFormat().equals("int64")) { + example = StringUtils.appendIfMissingIgnoreCase(example, "L"); + } + } else if (types.contains("number")) { + if (example == null) { + example = "3.4"; + } + if (schema.getFormat().equals("float")) { + example = StringUtils.appendIfMissingIgnoreCase(example, "F"); + } else if (schema.getFormat().equals("double")) { + example = StringUtils.appendIfMissingIgnoreCase(example, "D"); + } + } else if (types.contains("boolean")) { + if (example == null) { + example = "true"; + } + } else if (types.contains("array")) { + if (example == null) { + example = "Arrays.asList()"; + } + } else if (types.contains("object")) { + if (example == null) { + example = "new HashMap()"; + } + } else if (types.contains("null")) { + if (example == null) { + example = "null"; + } + } else if (hasAllowableValues) { + //parameter is enum defined as a schema component + example = ".fromValue(\"" + example + "\")"; + } + + if (example == null) { + example = "null"; + } + + return example; + } + + @Override + public String toExampleValue(Schema p) { + if (p.getExample() != null) { + return escapeText(p.getExample().toString()); + } else { + return null; + } + } + + @Override + public void setOpenAPI(OpenAPI openAPI) { + super.setOpenAPI(openAPI); + Components components = openAPI.getComponents(); + if (components != null && components.getSecuritySchemes() != null) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEMES); + } + List servers = openAPI.getServers(); + if (servers != null && !servers.isEmpty()) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS); + } + boolean pathsExist = openAPI.getPaths() != null && !openAPI.getPaths().isEmpty(); + if (pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.PATHS); + } + boolean componentResponsesExist = components != null && components.getResponses() != null && !components.getResponses().isEmpty(); + if (componentResponsesExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.RESPONSES); + } + boolean componentRequestBodiesExist = components != null && components.getRequestBodies() != null && !components.getRequestBodies().isEmpty(); + if (componentRequestBodiesExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.REQUEST_BODIES); + } + boolean componentParametersExist = components != null && components.getParameters() != null && !components.getParameters().isEmpty(); + if (componentParametersExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.PARAMETERS); + } + boolean componentHeadersExist = components != null && components.getHeaders() != null && !components.getHeaders().isEmpty(); + if (componentHeadersExist || pathsExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.HEADERS); + } + if (pathsExist || componentHeadersExist || componentParametersExist || componentRequestBodiesExist || componentResponsesExist) { + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.MEDIA_TYPE); + addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE.CONTENT_TYPE); + } + } + + private void addSupportingFiles(CodegenConstants.JSON_PATH_LOCATION_TYPE locationType) { + switch (locationType) { + case SECURITY_SCHEMES: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "ApiConfiguration.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "SecurityRequirementObject.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "AuthApplier.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "EmptySecurityRequirementObject.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs", + packagePath() + File.separatorChar + "securityrequirementobjects", + "SecurityRequirementObjectProvider.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "SecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "ApiKeyCookieSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "ApiKeyHeaderSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "ApiKeyQuerySecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpBasicSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpBearerSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpSignatureSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "HttpDigestSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "MutualTlsSecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "OAuth2SecurityScheme.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs", + packagePath() + File.separatorChar + "securityschemes", + "OpenIdConnectSecurityScheme.kt")); + + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITIES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITIES, + new HashMap<>() {{ + put("src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs", ".md"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEME, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEME, + new HashMap<>() {{ + put("src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs", ".md"); + }} + ); + break; + case SERVERS: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/Server.hbs", + packagePath() + File.separatorChar + "servers", + "Server.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/ServerProvider.hbs", + packagePath() + File.separatorChar + "servers", + "ServerProvider.kt")); + + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs", + packagePath() + File.separatorChar + "servers", + "ServerWithoutVariables.kt")); + + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/servers/ServerWithVariables.hbs", + packagePath() + File.separatorChar + "servers", + "ServerWithVariables.kt")); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerN.hbs", ".kt"); + }} + ); + jsonPathTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerInfo.hbs", ".kt"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVERS, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerInfoDoc.hbs", ".md"); + }} + ); + jsonPathDocTemplateFiles.put( + CodegenConstants.JSON_PATH_LOCATION_TYPE.SERVER, + new HashMap<>() {{ + put("src/main/kotlin/packagename/servers/ServerDoc.hbs", ".md"); + }} + ); + break; + case PATHS: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/ApiException.hbs", + packagePath() + File.separatorChar + "exceptions", + "ApiException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "ApiConfiguration.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/apiclient/ApiClient.hbs", + packagePath() + File.separatorChar + "apiclient", + "ApiClient.kt")); + // restclient + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/restclient/RestClient.hbs", + packagePath() + File.separatorChar + "restclient", + "RestClient.kt")); + break; + case RESPONSES: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/ApiException.hbs", + packagePath() + File.separatorChar + "exceptions", + "ApiException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/configurations/ApiConfiguration.hbs", + packagePath() + File.separatorChar + "configurations", + "ApiConfiguration.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ApiResponse.hbs", + packagePath() + File.separatorChar + "response", + "ApiResponse.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs", + packagePath() + File.separatorChar + "response", + "DeserializedHttpResponse.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/HeadersDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "HeadersDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ResponseDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "ResponseDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/response/ResponsesDeserializer.hbs", + packagePath() + File.separatorChar + "response", + "ResponsesDeserializer.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs", + testPackagePath() + File.separatorChar + "response", + "ResponseDeserializerTest.kt")); + break; + case REQUEST_BODIES: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs", + packagePath() + File.separatorChar + "requestbody", + "GenericRequestBody.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs", + packagePath() + File.separatorChar + "requestbody", + "RequestBodySerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs", + packagePath() + File.separatorChar + "requestbody", + "SerializedRequestBody.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs", + testPackagePath() + File.separatorChar + "requestbody", + "RequestBodySerializerTest.kt")); + break; + case CONTENT_TYPE: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeDetector.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs", + packagePath() + File.separatorChar + "contenttype", + "ContentTypeDeserializer.kt")); + break; + case MEDIA_TYPE: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/mediatype/MediaType.hbs", + packagePath() + File.separatorChar + "mediatype", + "MediaType.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/mediatype/Encoding.hbs", + packagePath() + File.separatorChar + "mediatype", + "Encoding.kt")); + break; + case HEADERS: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/Header.hbs", + packagePath() + File.separatorChar + "header", + "Header.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/HeaderBase.hbs", + packagePath() + File.separatorChar + "header", + "HeaderBase.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/SchemaHeader.hbs", + packagePath() + File.separatorChar + "header", + "SchemaHeader.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/ContentHeader.hbs", + packagePath() + File.separatorChar + "header", + "ContentHeader.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/StyleSerializer.hbs", + packagePath() + File.separatorChar + "header", + "StyleSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/Rfc6570Serializer.hbs", + packagePath() + File.separatorChar + "header", + "Rfc6570Serializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs", + packagePath() + File.separatorChar + "header", + "PrefixSeparatorIterator.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/header/SchemaHeaderTest.hbs", + testPackagePath() + File.separatorChar + "header", + "SchemaHeaderTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/header/ContentHeaderTest.hbs", + testPackagePath() + File.separatorChar + "header", + "ContentHeaderTest.kt")); + break; + case PARAMETERS: + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/exceptions/NotImplementedException.hbs", + packagePath() + File.separatorChar + "exceptions", + "NotImplementedException.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ContentParameter.hbs", + packagePath() + File.separatorChar + "parameter", + "ContentParameter.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/CookieSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "CookieSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/HeadersSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "HeadersSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/Parameter.hbs", + packagePath() + File.separatorChar + "parameter", + "Parameter.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterBase.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterBase.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterInType.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterInType.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/ParameterStyle.hbs", + packagePath() + File.separatorChar + "parameter", + "ParameterStyle.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/PathSerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "PathSerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/QuerySerializer.hbs", + packagePath() + File.separatorChar + "parameter", + "QuerySerializer.kt")); + supportingFiles.add(new SupportingFile( + "src/main/kotlin/packagename/parameter/SchemaParameter.hbs", + packagePath() + File.separatorChar + "parameter", + "SchemaParameter.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "CookieSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "HeadersSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/PathSerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "PathSerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "QuerySerializerTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "SchemaNonQueryParameterTest.kt")); + supportingFiles.add(new SupportingFile( + "src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs", + testPackagePath() + File.separatorChar + "parameter", + "SchemaQueryParameterTest.kt")); + break; + } + } + + @Override + public void preprocessOpenAPI(OpenAPI openAPI) { + super.preprocessOpenAPI(openAPI); + if (openAPI == null) { + return; + } + + // TODO: Setting additionalProperties is not the responsibility of this method. These side-effects should be moved elsewhere to prevent unexpected behaviors. + if (artifactVersion == null) { + // If no artifactVersion is provided in additional properties, version from API specification is used. + // If none of them is provided then fallbacks to default version + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION) && additionalProperties.get(CodegenConstants.ARTIFACT_VERSION) != null) { + this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION)); + } else if (openAPI.getInfo() != null && openAPI.getInfo().getVersion() != null) { + this.setArtifactVersion(openAPI.getInfo().getVersion()); + } else { + this.setArtifactVersion(ARTIFACT_VERSION_DEFAULT_VALUE); + } + } + // must be sequential after initial setting above + if (additionalProperties.containsKey(CodegenConstants.SNAPSHOT_VERSION)) { + final Object booleanValue = additionalProperties.get(CodegenConstants.SNAPSHOT_VERSION); + boolean result1 = Boolean.FALSE; + if (booleanValue instanceof Boolean) { + result1 = (Boolean) booleanValue; + } else if (booleanValue instanceof String) { + result1 = Boolean.parseBoolean((String) booleanValue); + } else { + LOGGER.warn("The value (generator's option) must be either boolean or string. Default to `false`."); + } + boolean result = result1; + additionalProperties.put(CodegenConstants.SNAPSHOT_VERSION, result); + if (result) { + this.setArtifactVersion(this.buildSnapshotVersion(this.getArtifactVersion())); + } + } + additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); + } + + private static String sanitizePackageName(String packageName) { + packageName = packageName.trim(); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + packageName = packageName.replaceAll("[^a-zA-Z0-9_\\.]", "_"); + if (Strings.isNullOrEmpty(packageName)) { + return "invalidPackageName"; + } + return packageName; + } + + public String getInvokerPackage() { + return invokerPackage; + } + + public void setInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + public String getArtifactUrl() { + return artifactUrl; + } + + public void setArtifactUrl(String artifactUrl) { + this.artifactUrl = artifactUrl; + } + + public String getArtifactDescription() { + return artifactDescription; + } + + public void setArtifactDescription(String artifactDescription) { + this.artifactDescription = artifactDescription; + } + + public String getScmConnection() { + return scmConnection; + } + + public void setScmConnection(String scmConnection) { + this.scmConnection = scmConnection; + } + + public String getScmDeveloperConnection() { + return scmDeveloperConnection; + } + + public void setScmDeveloperConnection(String scmDeveloperConnection) { + this.scmDeveloperConnection = scmDeveloperConnection; + } + + public String getScmUrl() { + return scmUrl; + } + + public void setScmUrl(String scmUrl) { + this.scmUrl = scmUrl; + } + + public String getDeveloperName() { + return developerName; + } + + public void setDeveloperName(String developerName) { + this.developerName = developerName; + } + + public String getDeveloperEmail() { + return developerEmail; + } + + public void setDeveloperEmail(String developerEmail) { + this.developerEmail = developerEmail; + } + + public String getDeveloperOrganization() { + return developerOrganization; + } + + public void setDeveloperOrganization(String developerOrganization) { + this.developerOrganization = developerOrganization; + } + + public String getDeveloperOrganizationUrl() { + return developerOrganizationUrl; + } + + public void setDeveloperOrganizationUrl(String developerOrganizationUrl) { + this.developerOrganizationUrl = developerOrganizationUrl; + } + + public String getLicenseName() { + return licenseName; + } + + public void setLicenseName(String licenseName) { + this.licenseName = licenseName; + } + + public String getLicenseUrl() { + return licenseUrl; + } + + public void setLicenseUrl(String licenseUrl) { + this.licenseUrl = licenseUrl; + } + + public String getSourceFolder() { + return sourceFolder; + } + + public void setSourceFolder(String sourceFolder) { + this.sourceFolder = sourceFolder; + } + + public void setOutputTestFolder(String outputTestFolder) { + this.outputTestFolder = outputTestFolder; + } + + @Override + public String escapeQuotationMark(String input) { + // remove " to avoid code injection + return input.replace("\"", ""); + } + + /* + * Derive invoker package name based on the input + * e.g. foo.bar.model => foo.bar + * + * @param input API package/model name + * @return Derived invoker package name based on API package/model name + */ + private String deriveInvokerPackageName(String input) { + String[] parts = input.split(Pattern.quote(".")); // Split on period. + + StringBuilder sb = new StringBuilder(); + String delim = ""; + for (String p : Arrays.copyOf(parts, parts.length - 1)) { + sb.append(delim).append(p); + delim = "."; + } + return sb.toString(); + } + + /** + * Builds a SNAPSHOT version from a given version. + * + * @param version the version + * @return SNAPSHOT version + */ + private String buildSnapshotVersion(String version) { + if (version.endsWith("-SNAPSHOT")) { + return version; + } + return version + "-SNAPSHOT"; + } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String kotlinPostProcessFile = System.getenv("KOTLIN_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(kotlinPostProcessFile)) { + return; // skip if KOTLIN_POST_PROCESS_FILE env variable is not defined + } + + // only process files with kotlin extension + if ("kt".equals(FilenameUtils.getExtension(file.toString()))) { + String command = kotlinPostProcessFile + " " + file; + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + int exitValue = p.exitValue(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: {}", command); + } + } catch (InterruptedException | IOException e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + // Restore interrupted state + Thread.currentThread().interrupt(); + } + } + } + + public void setParentGroupId(final String parentGroupId) { + this.parentGroupId = parentGroupId; + } + + public void setParentArtifactId(final String parentArtifactId) { + this.parentArtifactId = parentArtifactId; + } + + public void setParentVersion(final String parentVersion) { + this.parentVersion = parentVersion; + } + + @Override + public boolean generateSeparateServerSchemas() { + return true; + } + + /** + * Convert OAS Property object to Codegen Property object + * We have a custom version of this method to always set allowableValues.enumVars on all enum variables + * Together with unaliasSchema this sets primitive types with validations as models + * This method is used by fromResponse + * + * @param p OAS property schema + * @return Codegen Property object + */ + @Override + public CodegenSchema fromSchema(Schema p, String sourceJsonPath, String currentJsonPath) { + // fix needed for values with /n /t etc. in them + CodegenSchema cp = super.fromSchema(p, sourceJsonPath, currentJsonPath); + if (cp.types != null && cp.types.contains("integer") && cp.format == null) { + // this generator treats integers as type number + // so integer validation info must be set using formatting + cp.format = "int"; + } + return cp; + } + + @Override + public boolean shouldGenerateFile(String jsonPath, boolean isDoc) { + // exclude certain collection jsonPaths + if (jsonPath.equals("#/components/responses")) { + return false; + } else if (jsonPath.equals("#/components/headers")) { + return false; + } else if (jsonPath.equals("#/components/parameters")) { + return false; + } + String[] pathPieces = jsonPath.split("/"); + if (pathPieces.length == 4 && jsonPath.endsWith("/parameters")) { + // #/paths/path/parameters + return false; + } + return true; + } + + @Override + public String toApiFilename(String name) { + return toApiName(name); + } + + @Override + public String toApiName(String name) { + if (name.isEmpty()) { + return "DefaultApi"; + } + String usedName = sanitizeName(name, "[^a-zA-Z0-9]+"); + // todo check if empty and if so them use enum name + // todo fix this, this does not handle names starting with numbers + if (usedName.isEmpty()) { + usedName = toEnumVarName(name, null).toLowerCase(Locale.ROOT); + } + usedName = camelize(usedName, false); + return usedName; + } + + protected String responsePathFromDocRoot(String sourceJsonPath) { + return getPathFromDocRoot(sourceJsonPath); + } +} diff --git a/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java b/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java index c671cde084b..0bc6f625288 100644 --- a/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java +++ b/src/main/java/org/openapijsonschematools/codegen/generators/generatorloader/GeneratorLoader.java @@ -21,6 +21,7 @@ import org.openapijsonschematools.codegen.config.WorkflowSettings; import org.openapijsonschematools.codegen.generators.Generator; import org.openapijsonschematools.codegen.generators.JavaClientGenerator; +import org.openapijsonschematools.codegen.generators.KotlinClientGenerator; import org.openapijsonschematools.codegen.generators.PythonClientGenerator; import java.lang.reflect.Constructor; @@ -36,7 +37,8 @@ public class GeneratorLoader { private static final Map> generatorNameToGenerator = Map.ofEntries( new AbstractMap.SimpleEntry<>(JavaClientGenerator.generatorMetadata.getName(), JavaClientGenerator.class), - new AbstractMap.SimpleEntry<>(PythonClientGenerator.generatorMetadata.getName(), PythonClientGenerator.class) + new AbstractMap.SimpleEntry<>(PythonClientGenerator.generatorMetadata.getName(), PythonClientGenerator.class), + new AbstractMap.SimpleEntry<>(KotlinClientGenerator.generatorMetadata.getName(), KotlinClientGenerator.class) ); public static Generator getGenerator(String name, GeneratorSettings generatorSettings, WorkflowSettings workflowSettings) { diff --git a/src/main/resources/java/README.hbs b/src/main/resources/java/README.hbs index 022a99bd336..cab1927f0c8 100644 --- a/src/main/resources/java/README.hbs +++ b/src/main/resources/java/README.hbs @@ -1,4 +1,4 @@ -# {{artifactId}} +# {{generatorSettings.artifactId}} {{#if appDescription}} {{appDescription.original}} {{/if}} @@ -42,7 +42,7 @@ Add this dependency to your project's POM: ```xml {{{groupId}}} - {{{artifactId}}} + {{{generatorSettings.artifactId}}} {{{artifactVersion}}} compile @@ -60,12 +60,12 @@ Add this dependency to your project's build file: ``` repositories { - mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven centra - mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo + mavenCentral() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to maven centra + mavenLocal() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to the local maven repo } dependencies { - implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + implementation "{{{groupId}}}:{{{generatorSettings.artifactId}}}:{{{artifactVersion}}}" } ``` diff --git a/src/main/resources/java/build.gradle.hbs b/src/main/resources/java/build.gradle.hbs index 2b484053fcf..5071e968d9e 100644 --- a/src/main/resources/java/build.gradle.hbs +++ b/src/main/resources/java/build.gradle.hbs @@ -37,7 +37,7 @@ val testsJar by tasks.registering(Jar::class) { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of({{generatorMetadata.languageVersion}})) } withSourcesJar() withJavadocJar() diff --git a/src/main/resources/java/pom.hbs b/src/main/resources/java/pom.hbs index 48db5cc9f02..9d9bdb2f128 100644 --- a/src/main/resources/java/pom.hbs +++ b/src/main/resources/java/pom.hbs @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 {{groupId}} - {{artifactId}} + {{generatorSettings.artifactId}} jar - {{artifactId}} + {{generatorSettings.artifactId}} {{artifactVersion}} {{artifactUrl}} {{artifactDescription}} @@ -237,7 +237,7 @@ - 17 + {{generatorMetadata.languageVersion}} UTF-8 3.42.0 1.0.0 diff --git a/src/main/resources/java/settings.gradle.hbs b/src/main/resources/java/settings.gradle.hbs index 0a661d416eb..d83bd88e646 100644 --- a/src/main/resources/java/settings.gradle.hbs +++ b/src/main/resources/java/settings.gradle.hbs @@ -1,2 +1,2 @@ -rootProject.name = "{{artifactId}}" +rootProject.name = "{{generatorSettings.artifactId}}" diff --git a/src/main/resources/kotlin/README.hbs b/src/main/resources/kotlin/README.hbs new file mode 100644 index 00000000000..cc95baee1e0 --- /dev/null +++ b/src/main/resources/kotlin/README.hbs @@ -0,0 +1,245 @@ +# {{generatorSettings.artifactId}} +{{#if appDescription}} +{{appDescription.original}} +{{/if}} + +This Kotlin package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project: + +- OpenAPI document version: {{appVersion}} +- Kotlin Package version: {{artifactVersion}} +- OpenAPI JSON Schema Generator, Generator: {{generatorClass}} +{{#if infoUrl}} + +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/if}} + +## Requirements + +1. Kotlin {{generatorLanguageVersion}} +2. Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +gradle wrapper +gradlew clean build +``` + +### Gradle users + +Add this dependency to your project's build file: + +``` +repositories { + mavenCentral() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to maven centra + mavenLocal() // Needed if the '{{{generatorSettings.artifactId}}}' jar has been published to the local maven repo +} + +dependencies { + implementation "{{{groupId}}}:{{{generatorSettings.artifactId}}}:{{{artifactVersion}}}" +} +``` + +## Usage Notes +### Validation, Immutability, and Data Type +This Kotlin code validates data to schema classes and return back an immutable instance containing the data. This ensure that +- valid data cannot be mutated and become invalid to a set of schemas + - the one exception is that files are not immutable, so schema instances storing/sending/receiving files are not immutable + +Here is the mapping from json schema types to Kotlin types: + +| Json Schema Type | Kotlin Base Class | +| ---------------- | --------------- | +| object | FrozenMap (Map) | +| array | FrozenList (List) | +| string | String | +| number | Number (Int, Long, Float, Double) | +| integer | Int, Long, Float, Double (with values equal to integers) | +| boolean | Boolean | +| null | Nothing? (null) | +| AnyType (unset) | Any? | + +### Storage of Json Schema Definition in Kotlin JsonSchema Classes +In openapi v3.0.3 there are ~ 28 json schema keywords. Almost all of them can apply if +type is unset. I have chosen to separate the storage of +- json schema definition info +- output classes for validated Map (json schema type object) payloads +- output classes for validated List (json schema type array) payloads + +
+ Reason + +This json schema data is stored in each class that is written for a schema, in a component or +other openapi document location. This class is only responsible for storing schema info. +Output classes like those that store map payloads are written separately and are +returned by the JsonSchema.validate method when that method is passed in Map input. +This prevents payload property access methods from +colliding with json schema definition. +
+ +### Json Schema Type Object +Most component schemas (models) are probably of type object. Which is a map data structure. +Json schema allows string keys in this map, which means schema properties can have key names that are +invalid Kotlin variable names. Names like: +- "hi-there" +- "1variable" +- "@now" +- " " +- "from" + +To allow these use cases to work, FrozenMap (which extends AbstractMap) is used as the base class of type object schemas. +This means that one can use normal Map methods on instances of these classes. + +
+ Other Details + +- getters are written for validly named required and optional properties +- null is only allowed in as a value if type: "null" was included or nullable: true was set + - because null is an allowed property value, it is not used to represent an unset property state +- if an optional property is requested and it does not exist in the Map, an UnsetPropertyException is thrown +
+ +### Json Schema Type + Format, Validated Data Storage +N schemas can be validated on the same payload. +To allow multiple schemas to validate, the data must be stored using one base class whether or not +a json schema format constraint exists in the schema. + +In json schema, type: number with no format validates both integers and floats, +so int and float values are stored for type number. + +
+ String + Date Example + +For example the string payload '2023-12-20' is validates to both of these schemas: +1. string only +``` +- type: string +``` +2. string and date format +``` +- type: string + format: date +``` +Because of use cases like this, a LocalDate is allowed as an input to this schema, but the data +is stored as a string. +
+ +## Getting Started + +Please follow the [installation procedure](#installation) and then use the JsonSchema classes in +{{packageName}}.components.schemas to validate input payloads and instances of validated Map and List +output classes. Json schemas allow multiple types for one schema, so a schema's validate method can have +allowed input and output types. +{{#each paths}} + {{#if @first}} + {{#each operations}} + {{#if @first}} + {{#each tags}} + {{#if @first}} + +## Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample this=../this apiSubpackage="apis.tags" apiContainerClass=className apiFullyQualifiedClass=className }} + {{/if}} + {{/each}} + {{/if}} + {{/each}} + {{/if}} +{{/each}} +{{#if servers}} + +## Servers +| server_index | Class | Description | +| ------------ | ----- | ----------- | + {{#each servers}} +| {{@key}} | [{{jsonPathPiece.pascalCase}}](docs/servers/{{jsonPathPiece.pascalCase}}.md) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/each}} +{{/if}} +{{#if securitySchemes}} + +## Component SecuritySchemes +| Class | Description | +| ----- | ----------- | + {{#each securitySchemes}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}](docs/components/securityschemes/{{jsonPathPiece.snakeCase}}.md) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#and paths (gt paths.size 0)}} + +## Endpoints +All URIs are relative to the selected server +- The server is selected by passing in serverInfo + serverIndexInfo into configurations.ApiConfiguration +- The security info is selected by passing in securityInfo + securityIndexInfo into configurations.ApiConfiguration +- serverIndex + securityIndex can also be passed in to endpoint calls, see endpoint documentation + +| HTTP request | Methods | Description | +| ------------ | ------- | ----------- | + {{#each paths}} + {{#each operations}} +| {{../@key.original}} **{{@key.original}}** | {{#each tags}}[{{className}}.{{../operationId.camelCase}}](docs/apis/tags/{{className}}.md#{{../operationId.kebabCase}}) {{/each}} [{{../jsonPathPiece.pascalCase}}.{{method.camelCase}}](docs/apis/paths/{{../jsonPathPiece.pascalCase}}.md#{{method.kebabCase}}) [{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}.{{method.camelCase}}](docs/{{pathFromDocRoot}}.md#{{method.kebabCase}}) |{{#if summary}} {{summary.originalWithBr}}{{/if}} | + {{/each}} + {{/each}} +{{/and}} +{{#if schemas}} + +## Component Schemas +| Class | Description | +| ----- | ----------- | + {{#each schemas}} + {{#with this}} +| [{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}](docs/components/schemas/{{containerJsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if requestBodies}} + +## Component RequestBodies +| Class | Description | +| ----- | ----------- | + {{#each requestBodies}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/requestbodies/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if responses}} + +## Component Responses +| Class | Description | +| ----- | ----------- | + {{#each responses}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/responses/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}}| + {{/with}} + {{/each}} +{{/if}} +{{#if headers}} + +## Component Headers +| Class | Description | +| ----- | ----------- | + {{#each headers}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/headers/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if parameters}} + +## Component Parameters +| Class | Description | +| ----- | ----------- | + {{#each parameters}} + {{#with this}} +| [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](docs/components/parameters/{{jsonPathPiece.pascalCase}}.md#{{jsonPathPiece.kebabCase}}1) |{{#if description}} {{description.originalWithBr}}{{/if}} | + {{/with}} + {{/each}} +{{/if}} +{{#if infoEmail}} + +## Author +{{infoEmail}} +{{/if}} diff --git a/src/main/resources/kotlin/_helper_footer_links.hbs b/src/main/resources/kotlin/_helper_footer_links.hbs new file mode 100644 index 00000000000..034a0373b9f --- /dev/null +++ b/src/main/resources/kotlin/_helper_footer_links.hbs @@ -0,0 +1 @@ +{{#if serversLink}}[[Back to Servers]]({{readmePath}}README.md#Servers) {{/if}}{{#if securitySchemesLink}}[[Back to Component Security Schemes]]({{readmePath}}README.md#Component-SecuritySchemes) {{/if}}{{#if endpointsLink}}[[Back to Endpoints]]({{readmePath}}README.md#Endpoints) {{/if}}{{#if schemasLink}}[[Back to Component Schemas]]({{readmePath}}README.md#Component-Schemas) {{/if}}{{#if responsesLink}}[[Back to Component Responses]]({{readmePath}}README.md#Component-Responses) {{/if}}{{#if requestBodiesLink}}[[Back to Component RequestBodies]]({{readmePath}}README.md#Component-RequestBodies) {{/if}}{{#if headersLink}}[[Back to Component Headers]]({{readmePath}}README.md#Component-Headers) {{/if}}{{#if parametersLink}}[[Back to Component Parameters]]({{readmePath}}README.md#Component-Parameters) {{/if}}[[Back to README]]({{readmePath}}README.md) \ No newline at end of file diff --git a/src/main/resources/kotlin/_helper_header.hbs b/src/main/resources/kotlin/_helper_header.hbs new file mode 100644 index 00000000000..ae847f70eeb --- /dev/null +++ b/src/main/resources/kotlin/_helper_header.hbs @@ -0,0 +1,15 @@ +/* +{{#if appName}} + {{{appName}}} +{{/if}} +{{#if appDescription}} + {{{appDescription.original}}} +{{/if}} +{{#if version}} + The version of the OpenAPI document: {{{version}}} +{{/if}} +{{#if infoEmail}} + Contact: {{{infoEmail}}} +{{/if}} + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +*/ diff --git a/src/main/resources/kotlin/_helper_imports.hbs b/src/main/resources/kotlin/_helper_imports.hbs new file mode 100644 index 00000000000..617b31f6acc --- /dev/null +++ b/src/main/resources/kotlin/_helper_imports.hbs @@ -0,0 +1,3 @@ +{{#each imports}} +{{{.}}} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/build.gradle.hbs b/src/main/resources/kotlin/build.gradle.hbs new file mode 100644 index 00000000000..c9036f371c4 --- /dev/null +++ b/src/main/resources/kotlin/build.gradle.hbs @@ -0,0 +1,43 @@ +plugins { + kotlin("jvm") version "{{generatorMetadata.languageVersion}}" +} + +repositories { + mavenLocal() + maven { + url = uri("https://repo.maven.apache.org/maven2/") + } +} + +dependencies { + implementation(kotlin("reflect")) + testImplementation(kotlin("test")) + implementation("org.checkerframework:checker-qual:3.42.0") + implementation("com.google.code.gson:gson:2.10.1") + testImplementation("junit:junit:4.13.2") +} + +group = "{{groupId}}" +version = "{{artifactVersion}}" +description = "{{artifactDescription}}" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + +tasks.wrapper { + gradleVersion = "8.1.1" +} + +tasks.compileKotlin { + kotlinDaemonJvmArguments.add("-Xmx1g") +} + +tasks.test { + useJUnitPlatform() + testLogging { + events("passed", "skipped", "failed") + } +} diff --git a/src/main/resources/kotlin/gitignore.hbs b/src/main/resources/kotlin/gitignore.hbs new file mode 100644 index 00000000000..3a4ec036d04 --- /dev/null +++ b/src/main/resources/kotlin/gitignore.hbs @@ -0,0 +1,9 @@ +build/ +.gradle/ +.idea/ +target/ + +# gradle wrapper +gradlew +gradlew.bat +gradle/ \ No newline at end of file diff --git a/src/main/resources/kotlin/settings.gradle.hbs b/src/main/resources/kotlin/settings.gradle.hbs new file mode 100644 index 00000000000..d83bd88e646 --- /dev/null +++ b/src/main/resources/kotlin/settings.gradle.hbs @@ -0,0 +1,2 @@ +rootProject.name = "{{generatorSettings.artifactId}}" + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apiclient/ApiClient.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apiclient/ApiClient.hbs new file mode 100644 index 00000000000..6c88bcf8745 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apiclient/ApiClient.hbs @@ -0,0 +1,39 @@ +package {{packageName}}.apiclient; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; + +import java.net.http.HttpClient; +import java.time.Duration; + +public class ApiClient { + protected final ApiConfiguration apiConfiguration; + protected final SchemaConfiguration schemaConfiguration; + protected final HttpClient client; + + public ApiClient(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + this.apiConfiguration = apiConfiguration; + this.schemaConfiguration = schemaConfiguration; + @Nullable Duration timeout = apiConfiguration.getTimeout(); + if (timeout != null) { + this.client = HttpClient.newBuilder() + .connectTimeout(timeout) + .build(); + } else { + this.client = HttpClient.newHttpClient(); + } + } + + public ApiConfiguration getApiConfiguration() { + return apiConfiguration; + } + + public SchemaConfiguration getSchemaConfiguration() { + return schemaConfiguration; + } + + public HttpClient getClient() { + return client; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/apis_path_to_api.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/apis_path_to_api.hbs new file mode 100644 index 00000000000..51d32123e3a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/apis_path_to_api.hbs @@ -0,0 +1,23 @@ +import typing +import typing_extensions + +{{#each paths}} +from {{packageName}}.apis.paths.{{@key.snakeCase}} import {{@key.pascalCase}} +{{/each}} + +PathToApi = typing.TypedDict( + 'PathToApi', + { +{{#each paths}} + "{{{@key.original}}}": typing.Type[{{@key.pascalCase}}], +{{/each}} + } +) + +path_to_api = PathToApi( + { +{{#each paths}} + "{{{@key.original}}}": {{@key.pascalCase}}, +{{/each}} + } +) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/Api.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/Api.hbs new file mode 100644 index 00000000000..810d50ea53f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/Api.hbs @@ -0,0 +1,18 @@ +package {{packageName}}.apis.paths; + +import {{packageName}}.apiclient.ApiClient; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +{{#each pathItem.operations}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} + +public class {{pathItem.jsonPathPiece.pascalCase}} extends ApiClient implements +{{#each pathItem.operations}} + {{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Operation{{#unless @last}},{{/unless}} +{{/each}} +{ + public {{pathItem.jsonPathPiece.pascalCase}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/ApiDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/ApiDoc.hbs new file mode 100644 index 00000000000..e9d41a37e0e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/paths/ApiDoc.hbs @@ -0,0 +1,49 @@ +# {{pathItem.jsonPathPiece.pascalCase}} + +public class {{pathItem.jsonPathPiece.pascalCase}} extends extends ApiClient implements +{{#each pathItem.operations}} +[{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Operation]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}operation){{#unless @last}},{{/unless}} +{{/each}} + +{{#with pathItem}} +an api client class which contains all the routes for path="{{jsonPathPiece.original}}" + {{#if description}} +{{description.originalWithBr}} + {{/if}} +{{/with}} + +{{headerSize}}# Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#each pathItem.operations}} +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | [{{method.camelCase}}](#{{method.kebabCase}})([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request){{#if description}}
{{description.originalWithBr}}{{/if}} | +{{/each}} + +{{headerSize}}# Method Detail +{{#each pathItem.operations}} + +{{headerSize}}## {{method.camelCase}} +public {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} {{method.camelCase}}([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request) +{{#if description}} + +{{description.originalWithBr}} +{{/if}} + +**Parameters:**
+request - the input request + +**Returns:**
+{{#if nonErrorResponses }}the deserialized response{{else}}nothing (Nothing?){{/if}} + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +{{headerSize}}### Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample apiSubpackage="apis.paths" apiContainerClass=pathItem.jsonPathPiece.pascalCase apiFullyQualifiedClass=pathItem.jsonPathPiece.pascalCase }} +{{/each}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" endpointLink=true}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/Api.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/Api.hbs new file mode 100644 index 00000000000..e267977a943 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/Api.hbs @@ -0,0 +1,18 @@ +package {{packageName}}.apis.tags; + +import {{packageName}}.apiclient.ApiClient; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +{{#each operations}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} + +public class {{tag.className}} extends ApiClient implements +{{#each operations}} + {{jsonPathPiece.pascalCase}}.{{operationId.pascalCase}}Operation{{#unless @last}},{{/unless}} +{{/each}} +{ + public {{tag.className}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/ApiDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/ApiDoc.hbs new file mode 100644 index 00000000000..3ed34ee7ed8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/apis/tags/ApiDoc.hbs @@ -0,0 +1,49 @@ +# {{tag.className}} + +public class {{tag.className}} extends extends ApiClient implements +{{#each operations}} +[{{jsonPathPiece.pascalCase}}.{{operationId.pascalCase}}Operation]({{docRoot}}{{pathFromDocRoot}}.md#{{operationId.kebabCase}}operation){{#unless @last}},{{/unless}} +{{/each}} + +{{#with tag}} +an api client class which contains all the routes for tag="{{name}}" + {{#if description}} +{{description.originalWithBr}} + {{/if}} +{{/with}} + +{{headerSize}}# Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#each operations}} +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | [{{operationId.camelCase}}](#{{operationId.kebabCase}})([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request){{#if description}}
{{description.originalWithBr}}{{/if}} | +{{/each}} + +{{headerSize}}# Method Detail +{{#each operations}} + +{{headerSize}}## {{operationId.camelCase}} +public {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} {{operationId.camelCase}}([{{jsonPathPiece.pascalCase}}.{{method.pascalCase}}Request]({{docRoot}}{{pathFromDocRoot}}.md#{{method.kebabCase}}request) request) +{{#if description}} + +{{description.originalWithBr}} +{{/if}} + +**Parameters:**
+request - the input request + +**Returns:**
+{{#if nonErrorResponses }}the deserialized response{{else}}nothing (Nothing?){{/if}} + +**Throws:**
+IOException, InterruptedException - an exception happened when making the request
+ValidationException - the returned response body or header values do not conform the the schema validation requirements
+NotImplementedException - the request body serialization or deserialization has not yet been implemented
+ or the header content type deserialization has not yet been implemented for this contentType
+ApiException - server returned a response/contentType not defined in the openapi document
+ +{{headerSize}}### Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample apiSubpackage="apis.tags" apiContainerClass=tag.className apiFullyQualifiedClass=tag.className }} +{{/each}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" endpointLink=true}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_anchor_id.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_anchor_id.hbs new file mode 100644 index 00000000000..7046166f3a3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_anchor_id.hbs @@ -0,0 +1 @@ +{{#each identifierPieces}}{{#if this.kebabCase}}{{this.kebabCase}}{{else}}{{this}}{{/if}}{{#unless @last}}-{{/unless}}{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces.hbs new file mode 100644 index 00000000000..26dc623c609 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces.hbs @@ -0,0 +1 @@ +{{headerSize}} {{#each identifierPieces}}{{#if this.pascalCase}}{{this.pascalCase}}{{else}}{{this}}{{/if}}{{#unless @last}} {{/unless}}{{/each}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/Header.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/Header.hbs new file mode 100644 index 00000000000..1c5801e2e0b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/Header.hbs @@ -0,0 +1,72 @@ +{{#with header}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} + {{! must be in different packages }} + {{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + {{! class names must differ }} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + {{/neq}} +{{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +public class {{jsonPathPiece.pascalCase}} extends {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}} {} +{{/neq}} +{{else}} + {{#if schema}} +import {{packageName}}.header.SchemaHeader; + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/if}} + {{#if content}} +import {{packageName}}.header.ContentHeader; +import {{packageName}}.mediatype.MediaType; + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + +import java.util.AbstractMap; + {{/if}} + +public class {{jsonPathPiece.pascalCase}} { + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}{{/with}}{{/with}}, Nothing?> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + + public static class {{jsonPathPiece.pascalCase}}1 extends {{#if schema}}SchemaHeader{{else}}ContentHeader{{/if}} { + public {{jsonPathPiece.pascalCase}}1() { + super( + {{#eq required null}}false{{else}}{{required}}{{/eq}}, + null, + {{#eq explode null}}null{{else}}{{explode}}{{/eq}}, + {{#if schema}} + {{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}} + ); + {{else}} + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()) + {{/each}} + ); + {{/if}} + } + } +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/HeaderDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/HeaderDoc.hbs new file mode 100644 index 00000000000..f208ba5acfd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/headers/HeaderDoc.hbs @@ -0,0 +1,97 @@ +{{#with header}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}](../../components/headers/{{refInfo.refClass}}.md) + +A class (extended from the $ref class) that contains necessary nested header classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize header content + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes header value | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}](../../components/headers/{{refInfo.refClass}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that deserializes header, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested header classes +{{#if content}} +- a class that implements MediaType to store content schema info +{{/if}} +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the header value + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | +{{/each}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes a header | + +{{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 implements Header
+ +a class that deserializes a header value + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = {{#eq required null}}false{{else}}{{required}}{{/eq}}
whether the header is required | +| @Nullable ParameterStyle | ParameterStyle.SIMPLE | +| @Nullable Boolean explode | {{explode}} | +| @Nullable Boolean allowReserved | null | + {{#each content}} +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)())
the contentType to schema info | + {{else}} +| JsonSchema | schema = {{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}})().getInstance(){{/with}} + {{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| HttpHeaders | serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) | +| @Nullable Object | deserialize(List<String> inData, boolean validate, SchemaConfiguration configuration)
deserializes the header value | +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" headersLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/Parameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/Parameter.hbs new file mode 100644 index 00000000000..0366d444265 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/Parameter.hbs @@ -0,0 +1,78 @@ +{{#with parameter}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} + {{! must be in different packages }} + {{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + {{! class names must differ }} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + {{/neq}} +{{#neq jsonPathPiece.pascalCase refInfo.ref.jsonPathPiece.pascalCase}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +public class {{jsonPathPiece.pascalCase}} extends {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}} {} +{{/neq}} +{{else}} + {{#neq style null}} +import {{packageName}}.parameter.ParameterStyle; + {{/neq}} +import {{packageName}}.parameter.ParameterInType; + {{#if schema}} +import {{packageName}}.parameter.SchemaParameter; + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/if}} + {{#if content}} +import {{packageName}}.parameter.ContentParameter; +import {{packageName}}.mediatype.MediaType; + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + +import java.util.AbstractMap; + {{/if}} + +public class {{jsonPathPiece.pascalCase}} { + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}{{/with}}{{/with}}, Nothing?> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + + public static class {{jsonPathPiece.pascalCase}}1 extends {{#if schema}}Schema{{else}}Content{{/if}}Parameter { + public {{jsonPathPiece.pascalCase}}1() { + super( + "{{{name}}}", + ParameterInType.{{#eq in "query"}}QUERY{{else}}{{#eq in "path"}}PATH{{else}}{{#eq in "header"}}HEADER{{else}}{{#eq in "cookie"}}COOKIE{{/eq}}{{/eq}}{{/eq}}{{/eq}}, + {{#eq required null}}false{{else}}{{required}}{{/eq}}, + {{#eq style null}}null{{else}}ParameterStyle.{{#eq style "matrix"}}MATRIX{{else}}{{#eq style "label"}}LABEL{{else}}{{#eq style "form"}}FORM{{else}}{{#eq style "simple"}}SIMPLE{{else}}{{#eq style "spaceDelimited"}}SPACE_DELIMITED{{else}}{{#eq style "pipeDelimited"}}PIPE_DELIMITED{{else}}{{#eq style "deepObject"}}DEEP_OBJECT{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}, + {{#eq explode null}}null{{else}}{{explode}}{{/eq}}, + {{#eq allowReserved null}}false{{else}}{{allowReserved}}{{/eq}}, + {{#if schema}} + {{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}} + {{else}} + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()) + {{/each}} + {{/if}} + ); + } + } +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs new file mode 100644 index 00000000000..be7c48964ad --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/parameter/ParameterDoc.hbs @@ -0,0 +1,98 @@ +{{#with parameter}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}](../../components/parameters/{{refInfo.refClass}}.md) + +A class (extended from the $ref class) that contains necessary nested parameter classes +- a class that extends SchemaHeader/ContentHeader and is used to deserialize parameter content + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes parameter value | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}](../../components/parameters/{{refInfo.refClass}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that deserializes parameter, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested parameter classes +{{#if content}} +- a class that implements MediaType to store content schema info +{{/if}} +- a class that extends SchemaHeader/ContentHeader and is used to deserialize the parameter value + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | +{{/each}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes a parameter | + +{{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends {{#if schema}}Schema{{else}}Content{{/if}}Parameter
+ +a class that deserializes a parameter value + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | name = "{{{name}}}"
the parameter name | +| ParameterInType | inType = ParameterInType.{{#eq in "query"}}QUERY{{else}}{{#eq in "path"}}PATH{{else}}{{#eq in "header"}}HEADER{{else}}{{#eq in "cookie"}}COOKIE{{/eq}}{{/eq}}{{/eq}}{{/eq}}
the parameter in value | +| boolean | required = {{#eq required null}}false{{else}}{{required}}{{/eq}}
whether the parameter is required | +| @Nullable Boolean explode | {{#eq explode null}}null{{else}}{{explode}}{{/eq}} | +| @Nullable ParameterStyle | {{#eq style null}}null{{else}}ParameterStyle.{{#eq style "matrix"}}MATRIX{{else}}{{#eq style "label"}}LABEL{{else}}{{#eq style "form"}}FORM{{else}}{{#eq style "simple"}}SIMPLE{{else}}{{#eq style "spaceDelimited"}}SPACE_DELIMITED{{else}}{{#eq style "pipeDelimited"}}PIPE_DELIMITED{{else}}{{#eq style "deepObject"}}DEEP_OBJECT{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}}{{/eq}} | +| @Nullable Boolean allowReserved | {{#eq allowReserved null}}false{{else}}{{allowReserved}}{{/eq}} | + {{#each content}} +| AbstractMap.SimpleEntry | content = new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)())
the contentType to schema info | + {{else}} +| JsonSchema | schema = {{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}})().getInstance(){{/with}} + {{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Map | serialize(@Nullable Object inData, boolean validate, SchemaConfiguration configuration{{#eq in "query"}}, PrefixSeparatorIterator iterator{{/eq}})
deserializes the parameter value | +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" parametersLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs new file mode 100644 index 00000000000..cdb2b64f656 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBody.hbs @@ -0,0 +1,92 @@ +{{#with requestBody}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.requestbody.RequestBodySerializer; +import {{packageName}}.requestbody.GenericRequestBody; +import {{packageName}}.requestbody.SerializedRequestBody; +import {{packageName}}.mediatype.MediaType; + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + +import java.util.AbstractMap; +import java.util.Map; + +public class {{jsonPathPiece.pascalCase}} { + {{#if content}} + public sealed interface SealedMediaType permits {{#each content}}{{@key.pascalCase}}MediaType{{#unless @last}}, {{/unless}}{{/each}} {} + {{/if}} + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements SealedMediaType, MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}{{/with}}{{/with}}, Nothing?> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + + public static class {{jsonPathPiece.pascalCase}}1 extends RequestBodySerializer { + public {{jsonPathPiece.pascalCase}}1() { + super( + Map.ofEntries( + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()){{#unless @last}},{{/unless}} + {{/each}} + ), + {{#if required}}true{{else}}false{{/if}} + ); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + {{#eq content.size 1}} + {{#each content}} + {{@key.pascalCase}}RequestBody requestBody{{@index}} = ({{@key.pascalCase}}RequestBody) requestBody; + return serialize(requestBody{{@index}}.contentType(), requestBody{{@index}}.body().getData()); + {{/each}} + {{else}} + {{#each content}} + {{#if @first}} + if (requestBody instanceof {{@key.pascalCase}}RequestBody requestBody{{@index}}) { + {{else}} + {{#if @last}} + } else { + {{@key.pascalCase}}RequestBody requestBody{{@index}} = ({{@key.pascalCase}}RequestBody) requestBody; + {{else}} + } else if (requestBody instanceof {{@key.pascalCase}}RequestBody requestBody{{@index}}) { + {{/if}} + {{/if}} + return serialize(requestBody{{@index}}.contentType(), requestBody{{@index}}.body().getData()); + {{/each}} + } + {{/eq}} + } + } + + public sealed interface SealedRequestBody permits {{#each content}}{{@key.pascalCase}}RequestBody{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each content}} + public record {{@key.pascalCase}}RequestBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName }}{{/with}}{{/with}}{{/with}} body) implements SealedRequestBody, GenericRequestBody<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName }}{{/with}}{{/with}}{{/with}}> { + @Override + public String contentType() { + return "{{{@key.original}}}"; + } + } + {{/each}} +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs new file mode 100644 index 00000000000..75482f556d4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/requestbodies/RequestBodyDoc.hbs @@ -0,0 +1,133 @@ +{{#with requestBody}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md) + +A class (extended from the $ref class) that contains necessary nested request body classes +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that serializes request bodies | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}1]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that serializes SealedRequestBody request bodies, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested request body classes +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- a class that extends RequestBodySerializer and is used to serialize input SealedRequestBody instances +- SealedRequestBody, a sealed interface which contains all the contentType/schema input types +- records which implement SealedRequestBody, the concrete request body types + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedMediaType](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedmediatype") }})
media type sealed interface | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | +{{/each}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that serializes request bodies | +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedRequestBody](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedrequestbody") }})
request body sealed interface | +{{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}RequestBody](#{{@key.kebabCase}}requestbody)
implements sealed interface to store request body input | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedMediaType") }} +public sealed interface SealedMediaType
+permits
+{{#each content}} +[{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype){{#unless @last}},{{/unless}} +{{/each}} + +sealed interface that stores schema and encoding info + +{{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | +{{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1
+ +a class that serializes SealedRequestBody request bodies + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| boolean | required = {{#if required}}true{{else}}false{{/if}}
whether the request body is required | +| Map | content = Map.ofEntries(
{{#each content}}    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)()){{#unless @last}},{{/unless}}
{{/each}})
the contentType to schema info | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SerializedRequestBody | serialize([SealedRequestBody](#sealedrequestbody) requestBody)
called by endpoint when creating request body bytes | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedRequestBody") }} +public sealed interface SealedRequestBody
+permits
+{{#each content}} +[{{@key.pascalCase}}RequestBody](#{{@key.kebabCase}}requestbody){{#unless @last}},{{/unless}} +{{/each}} + +sealed interface that stores request contentType + validated schema data + +{{#each content}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "RequestBody" "")) }} +public record {{@key.pascalCase}}RequestBody
+implements [SealedRequestBody](#sealedrequestbody),
+GenericRequestBody<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}}>
+ +A record class to store request body input for contentType="{{{@key.original}}}" + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}RequestBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} body)
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | contentType()
always returns "{{{@key.original}}}" | +| {{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} | body()
returns the body passed in in the constructor | +{{/each}} +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" requestBodiesLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs new file mode 100644 index 00000000000..00589fe3bee --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/HeadersDeserializer.hbs @@ -0,0 +1,24 @@ +package {{packageName}}.{{headers.subpackage}}; + +import {{packageName}}.response.HeadersDeserializer; +{{#each headers}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} + +import java.util.Map; +import java.util.AbstractMap; + +public class {{headers.jsonPathPiece.pascalCase}} extends HeadersDeserializer<{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{/with}}> { + public {{headers.jsonPathPiece.pascalCase}}() { + super( + Map.ofEntries( +{{#each headers}} + new AbstractMap.SimpleEntry<>("{{{@key}}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} +{{/each}} + ), +{{#with headersObjectSchema}} + {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance() +{{/with}} + ); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/Response.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/Response.hbs new file mode 100644 index 00000000000..737633add09 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/Response.hbs @@ -0,0 +1,150 @@ +{{#with response}} +package {{packageName}}.{{subpackage}}; + +{{#if refInfo}} + {{#neq subpackage refInfo.ref.subpackage}} +import {{packageName}}.{{refInfo.ref.subpackage}}.{{refInfo.refModule}}; + {{/neq}} + +public class {{jsonPathPiece.pascalCase}} extends {{refInfo.refModule}} { + public static class {{jsonPathPiece.pascalCase}}1 extends {{refInfo.refModule}}1 {} +} +{{else}} +import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.response.ResponseDeserializer; +import {{packageName}}.response.DeserializedHttpResponse; +import {{packageName}}.exceptions.ApiException; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.NotImplementedException; + {{#if hasContentSchema}} +import {{packageName}}.mediatype.MediaType; + {{else}} +import {{packageName}}.schemas.validation.MapUtils; + {{/if}} + {{#each content}} + {{#with schema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + {{#with headersObjectSchema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{#if headers}} +import {{{packageName}}}.{{headers.subpackage}}.{{headers.jsonPathPiece.pascalCase}}; + {{/if}} + + {{#if content}} +import java.util.AbstractMap; + {{/if}} +import java.util.Map; +import java.net.http.HttpResponse; +import java.net.http.HttpHeaders; + +public class {{jsonPathPiece.pascalCase}} { + {{#if hasContentSchema}} + public sealed interface SealedMediaType permits {{#each content}}{{@key.pascalCase}}MediaType{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each content}} + + public record {{@key.pascalCase}}MediaType({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}} schema{{/with}}{{/with}}) implements SealedMediaType, MediaType<{{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}, Nothing?{{/with}}{{/with}}> { + public {{@key.pascalCase}}MediaType() { + this({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance(){{/with}}{{/with}}); + } + @Override + public Nothing? encoding() { + return null; + } + } + {{/each}} + public sealed interface SealedResponseBody permits {{#each content}}{{@key.pascalCase}}ResponseBody{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each content}} + public record {{@key.pascalCase}}ResponseBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName }}{{/with}}{{/with}}{{/with}} body) implements SealedResponseBody { } + {{/each}} + {{/if}} + + public static class {{jsonPathPiece.pascalCase}}1 extends ResponseDeserializer<{{#if hasContentSchema}}SealedResponseBody{{else}}Nothing?{{/if}}, {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}, {{#if hasContentSchema}}SealedMediaType{{else}}Nothing?{{/if}}> { + public {{jsonPathPiece.pascalCase}}1() { + super( + {{#if hasContentSchema}} + Map.ofEntries( + {{#each content}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new {{@key.pascalCase}}MediaType()){{#unless @last}},{{/unless}} + {{/each}} + ) + {{else}} + MapUtils.makeMap( + {{#each content}} + new AbstractMap.SimpleEntry("{{{@key.original}}}", null){{#unless @last}},{{/unless}} + {{/each}} + ) + {{/if}} + ); + } + + {{#if hasContentSchema}} + @Override + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + {{#eq content.size 1}} + {{#each content}} + {{@key.pascalCase}}MediaType thisMediaType = ({{@key.pascalCase}}MediaType) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new {{@key.pascalCase}}ResponseBody(deserializedBody); + {{/each}} + {{else}} + {{#each content}} + {{#if @first}} + if (mediaType instanceof {{@key.pascalCase}}MediaType thisMediaType) { + {{else}} + {{#if @last}} + } else { + {{@key.pascalCase}}MediaType thisMediaType = ({{@key.pascalCase}}MediaType) mediaType; + {{else}} + } else if (mediaType instanceof {{@key.pascalCase}}MediaType thisMediaType) { + {{/if}} + {{/if}} + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new {{@key.pascalCase}}ResponseBody(deserializedBody); + {{/each}} + } + {{/eq}} + } + {{else}} + @Override + protected Nothing? getBody(String contentType, Nothing? mediaType, byte[] body, SchemaConfiguration configuration) { + return null; + } + {{/if}} + + @Override + protected {{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}} getHeaders(HttpHeaders headers, SchemaConfiguration configuration){{#if headers}} throws ValidationException, NotImplementedException{{/if}} { + {{#if headers}} + return new {{headers.jsonPathPiece.pascalCase}}().deserialize(headers, configuration); + {{else}} + return null; + {{/if}} + } + } + + {{#if hasContentSchema}} + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } + {{else}} + @SuppressWarnings("serial") + public static class ResponseApiException extends ApiException { + public DeserializedHttpResponse deserializedResponse; + + public ResponseApiException(String s, HttpResponse response, DeserializedHttpResponse deserializedResponse) { + super(s, response); + this.deserializedResponse = deserializedResponse; + } + } + {{/if}} +} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/ResponseDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/ResponseDoc.hbs new file mode 100644 index 00000000000..ca1c83a31d8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/responses/ResponseDoc.hbs @@ -0,0 +1,140 @@ +{{#with response}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces jsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{jsonPathPiece.pascalCase}}.java +{{/if}} + +{{#if refInfo}} +public class {{jsonPathPiece.pascalCase}} extends [{{refInfo.refClass}}](../../components/responses/{{refInfo.refClass}}.md) + +A class (extended from the $ref class) that contains necessary nested response classes +- a class that extends ResponseDeserializer and is used to deserialize responses + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes responses | + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1 extends [{{refInfo.refClass}}1](../../components/responses/{{refInfo.refClass}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}1)
+ +a class that deserializes responses, extended from the $ref class + +{{else}} +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary nested response classes +{{#if hasContentSchema}} +- SealedMediaType, a sealed interface which contains all the schema/encoding info for each contentType +- records which implement SealedMediaType, the concrete media types +- SealedResponseBody, a sealed interface which contains all the contentType/schema types +- records which implement SealedResponseBody, the concrete response body types +{{/if}} +- a class that extends ResponseDeserializer and is used to deserialize responses + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#if hasContentSchema}} +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedMediaType](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedmediatype") }})
media type sealed interface | + {{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)
record storing schema + encoding for a specific contentType | + {{/each}} +| sealed interface | [{{jsonPathPiece.pascalCase}}.SealedResponseBody](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces "sealedresponsebody") }})
response body sealed interface | + {{#each content}} +| record | [{{jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody](#{{@key.kebabCase}}responsebody)
implements sealed interface to store response body | + {{/each}} +{{/if}} +| static class | [{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "1" "")) }})
class that deserializes responses | +{{#if hasContentSchema}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedMediaType") }} +public sealed interface SealedMediaType
+permits
+ {{#each content}} +[{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype){{#unless @last}},{{/unless}} + {{/each}} + +sealed interface that stores schema and encoding info + {{#each content}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "MediaType" "")) }} +public record {{@key.pascalCase}}MediaType
+implements [SealedMediaType](#sealedmediatype), MediaType<{{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}}, Nothing?> + +class storing schema info for a specific contentType + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}MediaType()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}[{{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}){{/with}}{{/with}} | schema()
the schema for this MediaType | +| Nothing? | encoding()
the encoding info | + {{/each}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces "SealedResponseBody") }} +public sealed interface SealedResponseBody
+permits
+ {{#each content}} +[{{@key.pascalCase}}ResponseBody](#{{@key.kebabCase}}responsebody){{#unless @last}},{{/unless}} + {{/each}} + +sealed interface that stores response body + + {{#each content}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join @key.pascalCase "ResponseBody" "")) }} +public record {{@key.pascalCase}}ResponseBody
+implements [SealedResponseBody](#sealedresponsebody) + +A record class to store response body for contentType="{{{@key.original}}}" + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{@key.pascalCase}}ResponseBody({{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} body)
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#with this}}{{#with schema}}{{containerJsonPathPiece.pascalCase}}.{{#with getSelfOrDeepestRef}}{{> src/main/kotlin/packagename/components/schemas/_sealedClassName forDocs=true }}{{/with}}{{/with}}{{/with}} | body()
returns the body passed in in the constructor | + {{/each}} +{{/if}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "1" "")) }} +public static class {{jsonPathPiece.pascalCase}}1
+extends ResponseDeserializer<{{#if hasContentSchema}}[SealedResponseBody](#sealedresponsebody){{else}}Nothing?{{/if}}, {{#with headersObjectSchema}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}){{else}}Nothing?{{/with}}, {{#if hasContentSchema}}[SealedMediaType](#sealedmediatype){{else}}Nothing?{{/if}}> + +a class that deserializes responses + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | + {{#if hasContentSchema}} +| Map | content = Map.ofEntries(
{{#each content}}    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", new [{{@key.pascalCase}}MediaType](#{{@key.kebabCase}}mediatype)()){{#unless @last}},{{/unless}}
{{/each}})
the contentType to schema info | + {{else}} +| Map | content = MapUtils.makeMap(
{{#each content}}    new AbstractMap.SimpleEntry<>("{{{@key.original}}}", null){{#unless @last}},{{/unless}}
{{/each}})
the contentType to schema info | + {{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| ApiResponse<{{#if hasContentSchema}}[SealedResponseBody](#sealedresponsebody){{else}}Nothing?{{/if}}, {{#with headersObjectSchema}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}){{else}}Nothing?{{/with}}> | deserialize(HttpResponse response, SchemaConfiguration configuration)
called by endpoint when deserialize responses | +{{/if}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" responsesLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs new file mode 100644 index 00000000000..46ced448e49 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema.hbs @@ -0,0 +1,20 @@ +{{#with schema}} +package {{packageName}}.{{subpackage}} + {{#if refInfo}} + +{{> _helper_imports }} + +class {{containerJsonPathPiece.pascalCase}} : {{refInfo.refModule}} { + // $refed class + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass identifierPieces=(append identifierPieces jsonPathPiece) simpleRef=true }} +} + {{else}} +{{> _helper_imports }} + +class {{> src/main/kotlin/packagename/components/schemas/_containerClassName }} { + // nest classes so all schemas and input/output classes can be public + {{> src/main/kotlin/packagename/components/schemas/Schema_getSchemas }} + +} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass.hbs new file mode 100644 index 00000000000..4afb95faa63 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass.hbs @@ -0,0 +1,66 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype }} + {{/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map }} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list }} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean }} + {{/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number }} + {{/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string }} + {{/if}} + {{else}} + {{#if isSimpleNull }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null }} + {{/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype }} + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs new file mode 100644 index 00000000000..3fbc8720d22 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_anytypeOrMultitype.hbs @@ -0,0 +1,154 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#if items}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} + {{/if}} + {{#if properties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} + {{/if}} + {{#if requiredProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} + {{/if}} + {{#neq exclusiveMaximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} + {{/neq}} + {{#neq exclusiveMinimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} + {{/neq}} + {{#neq maximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} + {{/neq}} + {{#neq minimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} + {{/neq}} + {{#neq multipleOf null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} + {{/neq}} + {{#neq maxItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} + {{/neq}} + {{#neq minItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} + {{/neq}} + {{#neq maxLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} + {{/neq}} + {{#neq minLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} + {{/neq}} + {{#neq maxProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} + {{/neq}} + {{#neq minProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} + {{/neq}} + {{#if additionalProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#neq uniqueItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} + {{/neq}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if patternInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if contains}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} + {{/if}} + {{#neq maxContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} + {{/neq}} + {{#neq minContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} + {{/neq}} + {{#if propertyNames}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} + {{/if}} + {{#if dependentRequired}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} + {{/if}} + {{#if dependentSchemas}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} + {{/if}} + {{#if patternProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} + {{/if}} + {{#if prefixItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} + {{/if}} + {{#if unevaluatedProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} + {{/if}} +), {{#with enumInfo}}{{#if typeToValues.null}}NullEnumValidator, {{/if}}{{#if typeToValues.boolean}}BooleanEnumValidator, {{/if}}{{#if typeToValues.string}}StringEnumValidator, {{/if}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}{{#each types}}{{#eq this "null"}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{else}}{{#eq this "boolean"}}BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{else}}{{#or (eq this "number") (eq this "integer")}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>{{else}}{{#eq this "string"}}StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{else}}{{#eq this "array"}}ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>{{else}}{{#eq this "object"}}MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap>{{/eq}}{{/eq}}{{/eq}}{{/or}}{{/eq}}{{/eq}}{{#unless @last}}, {{/unless}}{{else}}NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>, BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>, NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber>, StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>, ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList>, MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap>{{/each}} { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } +{{#if hasDiscriminatorWithNonEmptyMapping}} + {{!> components/schemas/schema_cls/_discriminator }} +{{/if}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs new file mode 100644 index 00000000000..c03b46fe12e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_boolean.hbs @@ -0,0 +1,67 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), BooleanSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedBoolean>{{#and enumInfo enumInfo.typeToValues.boolean}}, BooleanEnumValidator{{/and}} { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs new file mode 100644 index 00000000000..66a53ad2be6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_list.hbs @@ -0,0 +1,85 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if items}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} + {{/if}} + {{#neq maxItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} + {{/neq}} + {{#neq minItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#neq uniqueItems null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} + {{/neq}} + {{#if contains}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} + {{/if}} + {{#neq maxContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} + {{/neq}} + {{#neq minContains null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} + {{/neq}} + {{#if prefixItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedItems}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} + {{/if}} +), ListSchemaValidator<{{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}, {{jsonPathPiece.pascalCase}}BoxedList> { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs new file mode 100644 index 00000000000..ffcaf69cad4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_map.hbs @@ -0,0 +1,91 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if properties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} + {{/if}} + {{#if requiredProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} + {{/if}} + {{#neq maxProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} + {{/neq}} + {{#neq minProperties null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} + {{/neq}} + {{#if additionalProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if propertyNames}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} + {{/if}} + {{#if dependentRequired}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} + {{/if}} + {{#if dependentSchemas}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} + {{/if}} + {{#if patternProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} + {{#if unevaluatedProperties}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} + {{/if}} +), MapSchemaValidator<{{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}}, {{jsonPathPiece.pascalCase}}BoxedMap> { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } + {{#if hasDiscriminatorWithNonEmptyMapping}} + {{!> components/schemas/schema_cls/_discriminator }} + {{/if}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs new file mode 100644 index 00000000000..5e911ef5152 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_null.hbs @@ -0,0 +1,67 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), NullSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedVoid>{{#and enumInfo enumInfo.typeToValues.null}}, NullEnumValidator{{/and}} { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs new file mode 100644 index 00000000000..75f31e6851e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_number.hbs @@ -0,0 +1,85 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#neq exclusiveMaximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} + {{/neq}} + {{#neq exclusiveMinimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} + {{/neq}} + {{#neq maximum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} + {{/neq}} + {{#neq minimum null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} + {{/neq}} + {{#neq multipleOf null}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), {{#with enumInfo}}{{#if typeToValues.Integer}}IntegerEnumValidator, {{/if}}{{#if typeToValues.Long}}LongEnumValidator, {{/if}}{{#if typeToValues.Float}}FloatEnumValidator, {{/if}}{{#if typeToValues.Double}}DoubleEnumValidator, {{/if}}{{/with}}NumberSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedNumber> { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs new file mode 100644 index 00000000000..d2e5bd67e1c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_string.hbs @@ -0,0 +1,88 @@ + + +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses }} + + +class {{jsonPathPiece.pascalCase}} private constructor(): JsonSchema<{{jsonPathPiece.pascalCase}}Boxed>( + JsonSchemaInfo() + {{#if types}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} + {{/if}} + {{#if format}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} + {{/if}} + {{#neq maxLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} + {{/neq}} + {{#neq minLength null }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} + {{/neq}} + {{#if allOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} + {{/if}} + {{#if anyOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} + {{/if}} + {{#if oneOf}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} + {{/if}} + {{#if not}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} + {{/if}} + {{#if enumInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} + {{/if}} + {{#if patternInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} + {{/if}} + {{#if defaultValue}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} + {{/if}} + {{#if constInfo}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} + {{/if}} + {{#if if_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} + {{/if}} + {{#if then}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} + {{/if}} + {{#if else_}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} + {{/if}} +), StringSchemaValidator<{{jsonPathPiece.pascalCase}}BoxedString>{{#and enumInfo enumInfo.typeToValues.string}}, StringEnumValidator{{/and}}{{#if defaultValue}}, DefaultValueMethod{{/if}} { +{{#if componentModule}} + /* + NOTE: This class is auto generated by OpenAPI JSON Schema Generator. + Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator + + Do not edit the class manually. + {{#if description}} + + {{{description.original}}} + {{/if}} + */ +{{/if}} + + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor }} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor }} +{{#if defaultValue}} + @Throws(ValidationException::class) + override fun defaultValue(): String { + if (defaultValue is String) { + return defaultValue + } + throw ValidationException("Invalid type stored in defaultValue") + } +{{/if}} + {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox }} +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs new file mode 100644 index 00000000000..4750ba5ebad --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_Schema_varEqualsClass.hbs @@ -0,0 +1,110 @@ + + +{{#or isBooleanSchemaTrue isBooleanSchemaFalse}} + {{#if isBooleanSchemaTrue}} +class {{../jsonPathPiece.pascalCase}} : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + {{else}} +class {{jsonPathPiece.pascalCase}} : NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1() { + // NotAnyTypeSchema + {{/if}} +{{else}} + {{#if refInfo.refClass}} + {{#if simpleRef}} + {{#if refInfo.refModule}} + {{#with getDeepestRef}} +class {{../jsonPathPiece.pascalCase}} : {{jsonPathPiece.pascalCase}}() { + {{/with}} + {{else}} + {{#with refInfo.ref}} +class {{../jsonPathPiece.pascalCase}} : {{jsonPathPiece.pascalCase}}() {} + {{/with}} + {{/if}} + {{else}} +// when is this case used? + {{/if}} + {{else}} + {{#eq types null}} +class {{../jsonPathPiece.pascalCase}} : AnyTypeJsonSchema.AnyTypeJsonSchema1() { + {{else}} + {{#each types}} + {{#eq this "null"}} +class {{../jsonPathPiece.pascalCase}} : NullJsonSchema.NullJsonSchema1() { + {{/eq}} + {{#eq this "object"}} +class {{../jsonPathPiece.pascalCase}} : MapJsonSchema.MapJsonSchema1() { + {{/eq}} + {{#eq this "array"}} +class {{../jsonPathPiece.pascalCase}} : ListJsonSchema.ListJsonSchema1() { + {{/eq}} + {{#eq this "boolean"}} +class {{../jsonPathPiece.pascalCase}} : BooleanJsonSchema.BooleanJsonSchema1() { + {{/eq}} + {{#eq this "string"}} + {{#eq ../format "date"}} +class {{../jsonPathPiece.pascalCase}} : DateJsonSchema.DateJsonSchema1() { + {{/eq}} + {{#eq ../format "date-time"}} +class {{../jsonPathPiece.pascalCase}} : DateTimeJsonSchema.DateTimeJsonSchema1() { + {{/eq}} + {{#eq ../format "uuid"}} +class {{../jsonPathPiece.pascalCase}} : UuidJsonSchema.UuidJsonSchema1() { + {{/eq}} + {{#eq ../format "number"}} +class {{../jsonPathPiece.pascalCase}} : DecimalJsonSchema.DecimalJsonSchema1() { + {{/eq}} + {{#eq ../format "binary"}} +class {{jsonPathPiece.pascalCase}} : StringJsonSchema.StringJsonSchema1() { + // BinarySchema + {{/eq}} + {{#neq ../format "date"}} + {{#neq ../format "date-time"}} + {{#neq ../format "uuid"}} + {{#neq ../format "number"}} + {{#neq ../format "binary"}} +class {{../jsonPathPiece.pascalCase}} : StringJsonSchema.StringJsonSchema1() { + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "integer"}} + {{#eq ../format "int32"}} +class {{../jsonPathPiece.pascalCase}} : Int32JsonSchema.Int32JsonSchema1() { + {{/eq}} + {{#eq ../format "int64"}} +class {{../jsonPathPiece.pascalCase}} : Int64JsonSchema.Int64JsonSchema1() { + {{/eq}} + {{#neq ../format "int32"}} + {{#neq ../format "int64"}} +class {{../jsonPathPiece.pascalCase}} : IntJsonSchema.IntJsonSchema1() { + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "number"}} + {{#eq ../format null}} +class {{../jsonPathPiece.pascalCase}} : NumberJsonSchema.NumberJsonSchema1() { + {{else}} + {{#eq ../format "float"}} +class {{../jsonPathPiece.pascalCase}} : FloatJsonSchema.FloatJsonSchema1() { + {{else}} + {{#eq ../format "double"}} +class {{../jsonPathPiece.pascalCase}} : DoubleJsonSchema.DoubleJsonSchema1() { + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/eq}} + {{/if}} +{{/or}} + companion object { + @Volatile + private var instance: {{jsonPathPiece.pascalCase}}? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: {{jsonPathPiece.pascalCase}}().also { instance = it } + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs new file mode 100644 index 00000000000..0f23c607c88 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with additionalProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +additionalProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +additionalProperties = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +additionalProperties = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with additionalProperties}} +.additionalProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs new file mode 100644 index 00000000000..2af5d095d08 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +allOf = listOf(
+ {{~#each allOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +;)
+{{~else}} +.allOf(listOf( + {{#each allOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs new file mode 100644 index 00000000000..563c574a75a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +anyOf = listOf(
+ {{~#each anyOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.anyOf(listOf( + {{#each anyOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs new file mode 100644 index 00000000000..4c2f62d3326 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean.hbs @@ -0,0 +1,26 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedBoolean" "")) }} +data class {{jsonPathPiece.pascalCase}}BoxedBoolean
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +record that stores validated boolean payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedBoolean(boolean data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| boolean | data()
validated payload | +| Any? | getData()
validated payload | + +{{else}} +data class {{jsonPathPiece.pascalCase}}BoxedBoolean(val data: Boolean): {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs new file mode 100644 index 00000000000..f9d0dcf9f0d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass.hbs @@ -0,0 +1,39 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "Boxed" "")) }} +sealed interface {{jsonPathPiece.pascalCase}}Boxed
+permits
+{{#each types}} + {{#eq this "null"}} +[{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}){{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "boolean"}} +[{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}){{#unless @last}},{{/unless}} + {{/eq}} + {{#or (eq this "number") (eq this "integer")}} +[{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}){{#unless @last}},{{/unless}} + {{/or}} + {{#and (eq this "string") (neq ../format "binary") }} +[{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}){{#unless @last}},{{/unless}} + {{/and}} + {{#eq this "array"}} +[{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}){{#unless @last}},{{/unless}} + {{/eq}}{{#eq this "object"}} +[{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}){{#unless @last}},{{/unless}} + {{/eq}} +{{else}} +[{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}), +[{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) +{{/each}} + +sealed interface that stores validated payloads using boxed classes + +{{else}} +sealed interface {{jsonPathPiece.pascalCase}}Boxed { + fun getData(): Any? +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses.hbs new file mode 100644 index 00000000000..c911bda4b81 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses.hbs @@ -0,0 +1,31 @@ +{{#if types}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass }} + {{#each types}} + {{#eq this "null"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid }} + {{/eq}} + {{#eq this "boolean"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean }} + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString }} + {{/and}} + {{#or (eq this "number") (eq this "integer")}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber }} + {{/or}} + {{#eq this "array"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList }} + {{/eq}} + {{#eq this "object"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap }} + {{/eq}} + {{/each}} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClass }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedBoolean }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap }} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs new file mode 100644 index 00000000000..211a1edb6af --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedList.hbs @@ -0,0 +1,26 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedList" "")) }} +data class {{jsonPathPiece.pascalCase}}BoxedList
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +data class that stores validated List payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedList({{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList{{/if}} data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if arrayOutputJsonPathPiece}}[{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}){{else}}FrozenList{{/if}} | data()
validated payload | +| Any? | getData()
validated payload | + +{{else}} +data class {{jsonPathPiece.pascalCase}}BoxedList(val data: {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList{{/if}}) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs new file mode 100644 index 00000000000..5d0241d271c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedMap.hbs @@ -0,0 +1,25 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedMap" "")) }} +data class {{jsonPathPiece.pascalCase}}BoxedMap
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +data class that stores validated Map payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedMap({{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap{{/if}} data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if mapOutputJsonPathPiece}}[{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}){{else}}FrozenMap{{/if}} | data()
validated payload | +| Any? | getData()
validated payload | + +{{else}} +data class {{jsonPathPiece.pascalCase}}BoxedMap(val data: {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap{{/if}}) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data + } +} +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs new file mode 100644 index 00000000000..b4469dd365f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedNumber.hbs @@ -0,0 +1,26 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedNumber" "")) }} +data class {{jsonPathPiece.pascalCase}}BoxedNumber
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +data class that stores validated Number payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedNumber(Number data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Number | data()
validated payload | +| Any? | getData()
validated payload | + +{{else}} +data class {{jsonPathPiece.pascalCase}}BoxedNumber(val data: Number) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs new file mode 100644 index 00000000000..9ab56448c68 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedString.hbs @@ -0,0 +1,26 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedString" "")) }} +data class {{jsonPathPiece.pascalCase}}BoxedString
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +data class that stores validated String payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedString(String data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| String | data()
validated payload | +| Any? | getData()
validated payload | + +{{else}} +data class {{jsonPathPiece.pascalCase}}BoxedString(val data: String) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs new file mode 100644 index 00000000000..7b8d49eb0c6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedVoid.hbs @@ -0,0 +1,26 @@ +{{#if forDocs}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join jsonPathPiece.pascalCase "BoxedVoid" "")) }} +data class {{jsonPathPiece.pascalCase}}BoxedVoid
+implements [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }}) + +data class that stores validated null payloads, sealed permits implementation + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}BoxedVoid(Nothing? data)
Creates an instance, private visibility | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Nothing? | data()
validated payload | +| Any? | getData()
validated payload | + +{{else}} +data class {{jsonPathPiece.pascalCase}}BoxedVoid(val data: Nothing?) : {{jsonPathPiece.pascalCase}}Boxed { + override fun getData(): Any? { + return data + } +} + +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_const.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_const.hbs new file mode 100644 index 00000000000..1f463e8d943 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_const.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +constValue = {{#each constInfo.valueToName}}{{#with @key}}{{#eq type "string"}}"{{{value}}}"{{else}}{{#eq type "null"}}null{{else}}{{value}}{{/eq}}{{/eq}}{{/with}}{{/each}} +{{~else}} +.constValue({{#each constInfo.valueToName}}{{#with @key}}{{#eq type "string"}}"{{{value}}}"{{else}}{{#eq type "null"}}null{{else}}{{#eq type "boolean"}}{{value}}{{else}}new BigDecimal("{{value.toString}}"){{/eq}}{{/eq}}{{/eq}}{{/with}}{{/each}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs new file mode 100644 index 00000000000..31bc9d757a1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_contains.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with contains}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +contains = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +contains = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +contains = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with contains}} +.contains({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_default.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_default.hbs new file mode 100644 index 00000000000..e082984cb09 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_default.hbs @@ -0,0 +1,43 @@ +{{#with defaultValue}} + {{#if forDocs}} + {{#eq type "string"}} +defaultValue = "{{{value}}}" + {{~else}} + {{#or (eq type "number") (eq type "integer")}} +defaultValue = {{{value}}} + {{~else}} + {{#eq type "boolean"}} + {{#if value}} +defaultValue = true + {{~else}} +defaultValue = false + {{~/if}} + {{else}} + {{#eq type "null"}} +defaultValue = null + {{~/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{else}} + {{#eq type "string"}} +.defaultValue("{{{value}}}") + {{else}} + {{#or (eq type "number") (eq type "integer")}} +.defaultValue({{{value}}}) + {{else}} + {{#eq type "boolean"}} + {{#if value}} +.defaultValue(true) + {{else}} +.defaultValue(false) + {{/if}} + {{else}} + {{#eq type "null"}} +.defaultValue(null) + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs new file mode 100644 index 00000000000..a2b6d92b4f1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired.hbs @@ -0,0 +1,27 @@ +{{#if forDocs}} +dependentRequired = mapOf(
+ {{#each dependentRequired}} +    Pair(
+        "{{{@key}}}",
+        setOf( + {{#each this}} +            "{{{this}}}"{{#unless @last}},{{/unless}}
+ {{/each}} +        ) +    ){{#unless @last}},{{/unless}}
+ {{/each}} +) +{{else}} +.dependentRequired(mapOf( + {{#each dependentRequired}} + Pair( + "{{{@key}}}", + setOf( + {{#each this}} + "{{{this}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) + ){{#unless @last}},{{/unless}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs new file mode 100644 index 00000000000..e86ee0ca64b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +dependentSchemas = mapOf(
+ {{~#each dependentSchemas}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    "{{{@key.original}}}" to [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    "{{{@key.original}}}" to [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    "{{{@key.original}}}" to [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.dependentSchemas(mapOf( + {{#each dependentSchemas}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + "{{{@key.original}}}" to {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{else}} + "{{{@key.original}}}" to {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + "{{{@key.original}}}" to {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs new file mode 100644 index 00000000000..e5d245f1d41 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_else.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with else_}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +elseSchema = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +elseSchema = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +elseSchema = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with else_}} +.elseSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs new file mode 100644 index 00000000000..b7715ddbe86 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_enum.hbs @@ -0,0 +1,37 @@ +{{#if forDocs}} +enumValues = setOf(
+ {{~#each enumInfo.valueToName}} + {{#with @key}} + {{#eq type "string"}} +    "{{{value}}}"{{#unless @last}},{{/unless}}
+ {{~else}} + {{#eq type "null"}} +    null{{#unless @last}},{{/unless}}
+ {{~else}} +    {{value}}{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{~/eq}} + {{/with}} + {{/each}} +)
+{{~else}} +.enumValues(setOf( + {{#each enumInfo.valueToName}} + {{#with @key}} + {{#eq type "string"}} + "{{{value}}}"{{#unless @last}},{{/unless}} + {{else}} + {{#eq type "null"}} + null{{#unless @last}},{{/unless}} + {{else}} + {{#eq type "boolean"}} + {{value}}{{#unless @last}},{{/unless}} + {{else}} + BigDecimal("{{value.toString}}"){{#unless @last}},{{/unless}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/with}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum.hbs new file mode 100644 index 00000000000..6f0dd4709f3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +exclusiveMaximum = {{exclusiveMaximum}} +{{~else}} +.exclusiveMaximum({{exclusiveMaximum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum.hbs new file mode 100644 index 00000000000..292c7e6b6d5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +exclusiveMinimum = {{exclusiveMinimum}} +{{~else}} +.exclusiveMinimum({{exclusiveMinimum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_format.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_format.hbs new file mode 100644 index 00000000000..e3d691b79c4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_format.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +type = "{{format}}"; +{{~else}} +.format("{{format}}") +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs new file mode 100644 index 00000000000..20e3b36ce7b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_getNewInstanceObject_implementor.hbs @@ -0,0 +1,48 @@ + +override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { +{{#if types}} + {{#each types}} + {{#if @first}} + if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { + {{else}} + } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { + {{/if}} + {{#eq this "null"}} + return getNewInstance(null, pathToItem, pathToSchemas) + {{/eq}} + {{#eq this "boolean"}} + return getNewInstance(arg, pathToItem, pathToSchemas) + {{/eq}} + {{#or (eq this "integer") (eq this "number")}} + return getNewInstance(arg, pathToItem, pathToSchemas) + {{/or}} + {{#eq this "string" }} + return getNewInstance(arg, pathToItem, pathToSchemas) + {{/eq}} + {{#eq this "array"}} + return getNewInstance(arg, pathToItem, pathToSchemas) + {{/eq}} + {{#eq this "object"}} + return getNewInstance(arg, pathToItem, pathToSchemas) + {{/eq}} + {{#if @last}} + } + {{/if}} + {{/each}} +{{else}} + if (arg == null) { + return getNewInstance( null, pathToItem, pathToSchemas) + } else if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } else if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } +{{/if}} + throw RuntimeException("Invalid input type="+getClass(arg)+". It can't be instantiated by this schema") +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs new file mode 100644 index 00000000000..43e430e4a28 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_if.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with if_}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +if = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +if = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +if = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with if_}} +.ifSchema({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs new file mode 100644 index 00000000000..99f78e3e4b9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_items.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with items}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +items = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +items = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +items = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with items}} +.items({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains.hbs new file mode 100644 index 00000000000..75f36089843 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxContains = {{maxContains}} +{{~else}} +.maxContains({{maxContains}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems.hbs new file mode 100644 index 00000000000..5bb99dea663 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxItems = {{maxItems}} +{{~else}} +.maxItems({{maxItems}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength.hbs new file mode 100644 index 00000000000..0fc9d3f739d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxLength = {{maxLength}} +{{~else}} +.maxLength({{maxLength}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties.hbs new file mode 100644 index 00000000000..5d0e5b39183 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maxProperties = {{maxProperties}} +{{~else}} +.maxProperties({{maxProperties}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum.hbs new file mode 100644 index 00000000000..aa9f7148253 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +maximum = {{maximum}} +{{~else}} +.maximum({{maximum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains.hbs new file mode 100644 index 00000000000..213ca5c7cc6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minContains = {{minContains}} +{{~else}} +.minContains({{minContains}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems.hbs new file mode 100644 index 00000000000..70c3ebc4179 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minItems = {{minItems}} +{{~else}} +.minItems({{minItems}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength.hbs new file mode 100644 index 00000000000..1aa17753cfc --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minLength = {{minLength}} +{{~else}} +.minLength({{minLength}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties.hbs new file mode 100644 index 00000000000..50ec3408ac5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minProperties = {{minProperties}} +{{~else}} +.minProperties({{minProperties}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum.hbs new file mode 100644 index 00000000000..d1c1871dc81 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +minimum = {{minimum}} +{{~else}} +.minimum({{minimum}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs new file mode 100644 index 00000000000..0abc705144b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +multipleOf = BigDecimal("{{multipleOf.toString}}") +{{~else}} +.multipleOf(BigDecimal("{{multipleOf.toString}}")) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs new file mode 100644 index 00000000000..0783404513d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_not.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with not}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +not = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +not = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +not = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with not}} +.not({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs new file mode 100644 index 00000000000..3ccea84a7e9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +oneOf = listOf(
+ {{~#each oneOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +))
+{{~else}} +.oneOf(listOf( + {{#each oneOf}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern.hbs new file mode 100644 index 00000000000..616832ef70b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern.hbs @@ -0,0 +1,57 @@ +{{#if forDocs}} +pattern = Pattern.compile(
+ {{~#with patternInfo}} +    "{{{pattern.codeEscaped}}}"{{#if flags}},{{/if}}
+ {{~#if flags}} + {{#eq flags.size 1}} +    {{#each flags}}Pattern.{{#eq this "i"}}CASE_INSENSITIVE{{/eq}}{{#eq this "m"}}MULTILINE{{/eq}}{{#eq this "s"}}DOTALL{{/eq}}{{#eq this "u"}}UNICODE_CHARACTER_CLASS{{/eq}}{{/each}}
+ {{~else}} +    (
+ {{~#each flags}} + {{#eq this "i"}} +        Pattern.CASE_INSENSITIVE{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{#eq this "m"}} +        Pattern.MULTILINE{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{#eq this "s"}} +        Pattern.DOTALL{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{#eq this "u"}} +        Pattern.UNICODE_CHARACTER_CLASS{{#unless @last}} |{{/unless}}
+ {{~/eq}} + {{/each}} +    
+ {{~/eq}} + {{/if}} + {{/with}} +){{#unless @last}},{{/unless}}
+{{~else}} +.pattern(Pattern.compile( + {{#with patternInfo}} + "{{{pattern.codeEscaped}}}"{{#if flags}},{{/if}} + {{#if flags}} + {{#eq flags.size 1}} + {{#each flags}}Pattern.{{#eq this "i"}}CASE_INSENSITIVE{{/eq}}{{#eq this "m"}}MULTILINE{{/eq}}{{#eq this "s"}}DOTALL{{/eq}}{{#eq this "u"}}UNICODE_CHARACTER_CLASS{{/eq}}{{/each}} + {{else}} + ( + {{#each flags}} + {{#eq this "i"}} + Pattern.CASE_INSENSITIVE{{#unless @last}} |{{/unless}} + {{/eq}} + {{#eq this "m"}} + Pattern.MULTILINE{{#unless @last}} |{{/unless}} + {{/eq}} + {{#eq this "s"}} + Pattern.DOTALL{{#unless @last}} |{{/unless}} + {{/eq}} + {{#eq this "u"}} + Pattern.UNICODE_CHARACTER_CLASS{{#unless @last}} |{{/unless}} + {{/eq}} + {{/each}} + ) + {{/eq}} + {{/if}} + {{/with}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs new file mode 100644 index 00000000000..d497ca10bea --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +patternProperties = mapOf(
+ {{~#each patternProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    Pattern.compile("{{{@key.pattern.codeEscaped}}}") to [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    Pattern.compile("{{{@key.pattern.codeEscaped}}}") to [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    Pattern.compile("{{{@key.pattern.codeEscaped}}}") to [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.patternProperties(mapOf( + {{#each patternProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + Pattern.compile("{{{@key.pattern.codeEscaped}}}") to {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{else}} + Pattern.compile("{{{@key.pattern.codeEscaped}}}") to {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + Pattern.compile("{{{@key.pattern.codeEscaped}}}") to {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs new file mode 100644 index 00000000000..8f65e117883 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +prefixItems = listOf(
+ {{~#each prefixItems}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.prefixItems(listOf( + {{#each prefixItems}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{else}} + {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs new file mode 100644 index 00000000000..ed577dcefd1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_properties.hbs @@ -0,0 +1,29 @@ +{{#if forDocs}} +properties = mapOf(
+ {{~#each properties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +    "{{{@key.original}}}" to [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}}
+ {{~else}} +    "{{{@key.original}}}" to [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~/if}} + {{else}} +    "{{{@key.original}}}" to [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}})){{#unless @last}},{{/unless}}
+ {{~/if}} + {{/each}} +)
+{{~else}} +.properties(mapOf( + {{#each properties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} + "{{{@key.original}}}" to {{refInfo.refModule}}.{{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{else}} + "{{{@key.original}}}" to {{refInfo.refClass}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{else}} + "{{{@key.original}}}" to {{jsonPathPiece.pascalCase}}::class.java{{#unless @last}},{{/unless}} + {{/if}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs new file mode 100644 index 00000000000..f9afdc76514 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with propertyNames}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +propertyNames = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +propertyNames = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +propertyNames = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with propertyNames}} +.propertyNames({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs new file mode 100644 index 00000000000..63f6313577d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_required.hbs @@ -0,0 +1,13 @@ +{{#if forDocs}} +required = setOf(
+ {{~#each requiredProperties}} +    "{{{@key.original}}}"{{#unless @last}},{{/unless}}
+ {{~/each}} +)
+{{~else}} +.required(setOf( + {{#each requiredProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} +)) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs new file mode 100644 index 00000000000..f06777500eb --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_then.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with then}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +then = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +then = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +then = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{~/with}} +{{else}} + {{#with then}} +.then({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs new file mode 100644 index 00000000000..4b67a923f1a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_types.hbs @@ -0,0 +1,79 @@ +{{#if types}} + {{#and (eq types.size 1) (or (contains types "null") (contains types "object") (contains types "array") (contains types "boolean"))}} + {{#if forDocs}} +type = setOf({{#contains types "null"}}Void::class.java{{/contains}}{{#contains types "object"}}Map::class.java{{/contains}}{{#contains types "array"}}List::class.java{{/contains}}{{#contains types "boolean"}}Boolean::class.java{{/contains}}) + {{~else}} +.type(setOf({{#contains types "null"}}Void::class.java{{/contains}}{{#contains types "object"}}Map::class.java{{/contains}}{{#contains types "array"}}List::class.java{{/contains}}{{#contains types "boolean"}}Boolean::class.java{{/contains}})) + {{/if}} + {{else}} + {{#if forDocs}} +type = setOf(
+ {{~#each types}} + {{#eq this "null"}} +    Void::class.java{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "object"}} +    Map::class.java{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "array"}} +    List::class.java{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "string" }} + {{#eq ../format "binary"}} + // FileIO, + // bytes, + {{else}} +    String::class.java{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{/eq}} + {{#eq this "integer"}} +    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "number"}} +    Int::class.java,
    Long::class.java,
    Float::class.java,
    Double::class.java{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{#eq this "boolean"}} +    Boolean::class.java{{#unless @last}},{{/unless}}
+ {{~/eq}} + {{/each}} +)
+ {{~else}} +.type(setOf( + {{#each types}} + {{#eq this "null"}} + Void::class.java{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "object"}} + Map::class.java{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "array"}} + List::class.java{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "string" }} + {{#eq ../format "binary"}} + // FileIO, + // bytes, + {{else}} + String::class.java{{#unless @last}},{{/unless}} + {{/eq}} + {{/eq}} + {{#eq this "integer"}} + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "number"}} + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java{{#unless @last}},{{/unless}} + {{/eq}} + {{#eq this "boolean"}} + Boolean::class.java{{#unless @last}},{{/unless}} + {{/eq}} + {{/each}} +)) + {{/if}} + {{/and}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs new file mode 100644 index 00000000000..4aeffcfea2d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with unevaluatedItems}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +unevaluatedItems = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +unevaluatedItems = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +unevaluatedItems = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with unevaluatedItems}} +.unevaluatedItems({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs new file mode 100644 index 00000000000..1dcc7ef2bbb --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties.hbs @@ -0,0 +1,17 @@ +{{#if forDocs}} + {{#with unevaluatedProperties}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +unevaluatedProperties = [{{refInfo.refModule}}.{{refInfo.refClass}}::class.java]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~else}} +unevaluatedProperties = [{{refInfo.refClass}}::class.java](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} +unevaluatedProperties = [{{jsonPathPiece.pascalCase}}::class.java](#{{jsonPathPiece.kebabCase}}) + {{~/if}} + {{/with}} +{{else}} + {{#with unevaluatedProperties}} +.unevaluatedProperties({{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.pascalCase}}{{/if}}::class.java) + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems.hbs new file mode 100644 index 00000000000..2d0946f2ede --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems.hbs @@ -0,0 +1,5 @@ +{{#if forDocs}} +uniqueItems = {{uniqueItems}} +{{~else}} +.uniqueItems({{uniqueItems}}) +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs new file mode 100644 index 00000000000..53b08438b10 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBox.hbs @@ -0,0 +1,93 @@ +{{#if types}} + {{#each types}} + {{#eq this "null"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid }} + {{/eq}} + {{#eq this "boolean"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean }} + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString }} + {{/and}} + {{#or (eq this "number") (eq this "integer")}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber }} + {{/or}} + {{#eq this "array"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList }} + {{/eq}} + {{#eq this "object"}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap }} + {{/eq}} + {{/each}} +@Throws(ValidationException::class) +override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}Boxed { + {{#each types}} + {{#if @first}} + {{#eq this "null"}} + if (arg == null) { + {{/eq}} + {{#eq this "boolean"}} + if (arg is Boolean) { + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} + if (arg is String) { + {{/and}} + {{#or (eq this "number") (eq this "integer")}} + if (arg is Number) { + {{/or}} + {{#eq this "array"}} + if (arg is List<*>) { + {{/eq}} + {{#eq this "object"}} + if (arg is Map<*, *>) { + {{/eq}} + {{else}} + {{#eq this "null"}} + } else if (arg == null) { + {{/eq}} + {{#eq this "boolean"}} + } else if (arg is Boolean) { + {{/eq}} + {{#and (eq this "string") (neq ../format "binary") }} + } else if (arg is String) { + {{/and}} + {{#or (eq this "number") (eq this "integer")}} + } else if (arg is Number) { + {{/or}} + {{#eq this "array"}} + } else if (arg is List<*>) { + {{/eq}} + {{#eq this "object"}} + } else if (arg is Map<*, *>) { + {{/eq}} + {{/if}} + return validateAndBox(arg, configuration) + {{/each}} + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") +} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap }} +@Throws(ValidationException::class) +override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } else if (arg is Boolean) { + return validateAndBox(arg, configuration) + } else if (arg is String) { + return validateAndBox(arg, configuration) + } else if (arg is Number) { + return validateAndBox(arg, configuration) + } else if (arg is List<*>) { + return validateAndBox(arg, configuration) + } else if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") +} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs new file mode 100644 index 00000000000..33b11c9b517 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxBoolean.hbs @@ -0,0 +1,4 @@ +@Throws(ValidationException::class) +override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedBoolean { + return {{jsonPathPiece.pascalCase}}BoxedBoolean(validate(arg, configuration)) +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs new file mode 100644 index 00000000000..8c78e956b5c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxList.hbs @@ -0,0 +1,4 @@ +@Throws(ValidationException::class) +override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedList { + return {{jsonPathPiece.pascalCase}}BoxedList(validate(arg, configuration)) +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs new file mode 100644 index 00000000000..4c73115a95b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxMap.hbs @@ -0,0 +1,4 @@ +@Throws(ValidationException::class) +override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedMap { + return {{jsonPathPiece.pascalCase}}BoxedMap(validate(arg, configuration)) +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs new file mode 100644 index 00000000000..5b13aae9add --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxNumber.hbs @@ -0,0 +1,4 @@ +@Throws(ValidationException::class) +override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedNumber { + return {{jsonPathPiece.pascalCase}}BoxedNumber(validate(arg, configuration)) +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs new file mode 100644 index 00000000000..b34537fed38 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxString.hbs @@ -0,0 +1,4 @@ +@Throws(ValidationException::class) +override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedString { + return {{jsonPathPiece.pascalCase}}BoxedString(validate(arg, configuration)) +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs new file mode 100644 index 00000000000..0d856088609 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validateAndBoxVoid.hbs @@ -0,0 +1,4 @@ +@Throws(ValidationException::class) +override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): {{jsonPathPiece.pascalCase}}BoxedVoid { + return {{jsonPathPiece.pascalCase}}BoxedVoid(validate(arg, configuration)) +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs new file mode 100644 index 00000000000..84417d596e2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/SchemaClass/_validate_implementor.hbs @@ -0,0 +1,532 @@ +{{#if types}} + {{#each types}} + {{#eq this "null"}} + +@Throws(ValidationException::class) +override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + {{/eq}} + {{#eq this "object"}} + +override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap{{/if}} { + val properties: LinkedHashMap src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = LinkedHashMap() + for((entryKey, value) in arg) { + if (!(entryKey is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + {{#if ../mapValueSchema}} + {{#if ../mapValueSchema.isNullableObject }} + properties[entryKey] = propertyInstance + {{else}} + if (!({{#contains ../mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance is {{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") + } + properties[entryKey] = propertyInstance + {{/if}} + {{else}} + properties[entryKey] = propertyInstance + {{/if}} + } + val castProperties: FrozenMap<{{#with ../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenMap(properties) + {{#if ../mapOutputJsonPathPiece}} + return {{mapOutputJsonPathPiece.pascalCase}}(castProperties) + {{else}} + return castProperties + {{/if}} +} + +@Throws(ValidationException::class) +override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): {{#if ../mapOutputJsonPathPiece}}{{../mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) +} + + {{/eq}} + {{#eq this "array"}} + +override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val items: MutableList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + {{#if ../listItemSchema}} + {{#if ../listItemSchema.isNullableObject }} + items.add(itemInstance) + {{else}} + if (!({{#contains ../listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance is {{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + {{/if}} + {{else}} + items.add(itemInstance) + {{/if}} + i += 1 + } + val newInstanceItems: FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenList(items) + {{#if ../arrayOutputJsonPathPiece}} + return {{../arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems) + {{else}} + return newInstanceItems + {{/if}} +} + +@Throws(ValidationException::class) +override fun validate(arg: List<*>, configuration: SchemaConfiguration?): {{#if ../arrayOutputJsonPathPiece}}{{../arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) +} + {{/eq}} + {{#eq this "string" }} + {{#eq ../format "binary"}} +// FileIO, +// bytes, + {{else}} + +@Throws(ValidationException::class) +override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + {{/eq}} + {{/eq}} + {{#eq this "integer"}} + +@Throws(ValidationException::class) +override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int +} + +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float +} + {{#neq ../format "int32"}} + +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long +} + +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double +} + {{/neq}} + {{/eq}} + {{#eq this "number"}} + +@Throws(ValidationException::class) +override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + {{#eq ../format null}} + +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int +} + +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long +} + +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float +} + +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double +} + {{else}} + {{#eq ../format "int32"}} +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int +} + +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float +} + {{else}} + {{#eq ../format "int64"}} +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int +} + +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long +} + +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float +} + +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double +} + {{else}} + {{#eq ../format "float"}} +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float +} + {{else}} + {{#eq ../format "double"}} +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double +} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{#eq this "boolean"}} + +@Throws(ValidationException::class) +override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + {{/eq}} + {{/each}} +{{else}} + +@Throws(ValidationException::class) +override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + +@Throws(ValidationException::class) +override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + +@Throws(ValidationException::class) +override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + +@Throws(ValidationException::class) +fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int +} + +@Throws(ValidationException::class) +fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long +} + +@Throws(ValidationException::class) +fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float +} + +@Throws(ValidationException::class) +fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double +} + +@Throws(ValidationException::class) +override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + getPathToSchemas(this, castArg, validationMetadata, pathSet) + return castArg +} + +@Throws(ValidationException::class) +fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) +} + +@Throws(ValidationException::class) +fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) +} + +@Throws(ValidationException::class) +fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) +} + +override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val items: MutableList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = ArrayList() + var i: Int = 0 + for (item: Any? in arg) { + val itemPathToItem = pathToItem + i + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(itemPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val itemInstance: Any? = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + {{#if listItemSchema}} + {{#if listItemSchema.isNullableObject }} + items.add(itemInstance) + {{else}} + if (!({{#contains listItemSchema.types "null" }}itemInstance == null || {{/contains}}itemInstance is {{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") + } + items.add(itemInstance) + {{/if}} + {{else}} + items.add(itemInstance) + {{/if}} + i += 1 + } + val newInstanceItems: FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenList(items) + {{#if arrayOutputJsonPathPiece}} + return {{arrayOutputJsonPathPiece.pascalCase}}(newInstanceItems) + {{else}} + return newInstanceItems + {{/if}} +} + +@Throws(ValidationException::class) +override fun validate(arg: List<*>, configuration: SchemaConfiguration?): {{#if arrayOutputJsonPathPiece}}{{arrayOutputJsonPathPiece.pascalCase}}{{else}}FrozenList<{{#with ../listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) +} + +override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}>{{/if}} { + val properties: LinkedHashMap src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = LinkedHashMap() + for((propertyName, value) in arg) { + if (!(propertyName is String)) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + propertyName + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas.get(propertyPathToItem) + if (schemas == null) { + throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + } + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val propertyInstance: Any? = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + {{#if mapValueSchema}} + {{#if mapValueSchema.isNullableObject }} + properties[propertyName] = propertyInstance + {{else}} + if (!({{#contains mapValueSchema.types "null" }}propertyInstance == null || {{/contains}}propertyInstance is {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true noAnnotations=true }}{{else}}Any{{/with}})) { + throw RuntimeException("Invalid instantiated value") + } + properties[propertyName] = propertyInstance + {{/if}} + {{else}} + properties[propertyName] = propertyInstance + {{/if}} + } + val castProperties: FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any?{{/with}}> = FrozenMap(properties) + {{#if ../mapOutputJsonPathPiece}} + return {{mapOutputJsonPathPiece.pascalCase}}(castProperties) + {{else}} + return castProperties + {{/if}} +} + +@Throws(ValidationException::class) +override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): {{#if mapOutputJsonPathPiece}}{{mapOutputJsonPathPiece.pascalCase}}{{else}}FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}? out Any?{{/with}}>{{/if}} { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) +} +{{/if}} + {{#and enumInfo enumInfo.typeToValues.null}} + +@Throws(ValidationException::class) +override fun validate(arg: Null{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Nothing? { + return validate(arg.value(), configuration) +} + {{/and}} + {{#and enumInfo enumInfo.typeToValues.boolean}} + +@Throws(ValidationException::class) +override fun validate(arg: Boolean{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Boolean { + return validate(arg.value(), configuration) +} + {{/and}} + {{#and enumInfo enumInfo.typeToValues.string}} + +@Throws(ValidationException::class) +override fun validate(arg: String{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): String { + return validate(arg.value(), configuration) +} + {{/and}} + {{#and enumInfo enumInfo.typeToValues.Integer}} + +@Throws(ValidationException::class) +override fun validate(arg: Integer{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Int { + return validate(arg.value() as Number, configuration) as Int +} + {{/and}} + {{#and enumInfo enumInfo.typeToValues.Long}} + +@Throws(ValidationException::class) +override fun validate(arg: Long{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Long { + return validate(arg.value() as Number, configuration) as Long +} + {{/and}} + {{#and enumInfo enumInfo.typeToValues.Float}} + +@Throws(ValidationException::class) +override fun validate(arg: Float{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Float { + return validate(arg.value() as Number, configuration) as Float +} + {{/and}} + {{#and enumInfo enumInfo.typeToValues.Double}} + +@Throws(ValidationException::class) +override fun validate(arg: Double{{enumInfo.jsonPathPiece.pascalCase}}, configuration: SchemaConfiguration?): Double { + return validate(arg.value() as Number, configuration) as Double +} + {{/and}} + +@Throws(ValidationException::class) +override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { +{{#if types}} + {{#each types}} + {{#if @first}} + if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { + {{else}} + } else if (arg {{#eq this "null"}}== null{{/eq}}{{#eq this "boolean"}}is Boolean{{/eq}}{{#or (eq this "integer") (eq this "number")}}is Number{{/or}}{{#eq this "string" }}is String{{/eq}}{{#eq this "array"}}is List<*>{{/eq}}{{#eq this "object"}}is Map<*, *>{{/eq}}) { + {{/if}} + {{#eq this "null"}} + return validate(null, configuration) + {{/eq}} + {{#eq this "boolean"}} + return validate(arg, configuration) + {{/eq}} + {{#or (eq this "integer") (eq this "number")}} + return validate(arg, configuration) + {{/or}} + {{#eq this "string" }} + return validate(arg, configuration) + {{/eq}} + {{#eq this "array"}} + return validate(arg, configuration) + {{/eq}} + {{#eq this "object"}} + return validate(arg, configuration) + {{/eq}} + {{#if @last}} + } + {{/if}} + {{/each}} +{{else}} + if (arg == null) { + return validate(null, configuration) + } else if (arg is Boolean) { + return validate(arg, configuration) + } else if (arg is Number) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } else if (arg is List<*>) { + return validate(arg, configuration) + } else if (arg is Map<*, *>) { + return validate(arg, configuration) + } +{{/if}} + throw ValidationException("Invalid input type="+getClass(arg)+". It can't be validated by this schema") +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs new file mode 100644 index 00000000000..6a76c303d1f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_doc.hbs @@ -0,0 +1,330 @@ +{{#with schema}} +{{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces containerJsonPathPiece) }} +{{else}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces }} +{{/eq}} +{{#if componentModule}} +{{moduleLocation}}.java +{{/if}} +class {{containerJsonPathPiece.pascalCase}}
+{{#if refInfo}} +extends [{{refInfo.refClass}}]({{docRoot}}{{#with refInfo.ref}}{{pathFromDocRoot}}.md#{{containerJsonPathPiece.kebabCase}}{{/with}}) +{{/if}} + +A class that contains necessary nested +- schema classes (which validate payloads), extends JsonSchema +- sealed interfaces which store validated payloads, Kotlin version of a sum type +- boxed classes which store validated payloads, sealed permits class implementations +{{#if containsArrayOutputClass}} +- classes to store validated list payloads, extends FrozenList +- classes to build inputs for list payloads +{{/if}} +{{#if containsObjectOutputClass}} +- classes to store validated map payloads, extends FrozenMap +- classes to build inputs for map payloads +{{/if}} +{{#if containsEnums}} +- enum classes +{{/if}} + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | ---------------------- | +{{#each (reverse getSchemas)}} + {{#eq instanceType "schema"}} + {{#eq refInfo null }} +| sealed interface | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" "")) }})
sealed interface for validated payloads | + {{#each types}} + {{#eq this "null"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}})
boxed class to store validated null payloads | + {{/eq}} + {{#eq this "boolean"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}})
boxed class to store validated boolean payloads | + {{/eq}} + {{#or (eq this "number") (eq this "integer")}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}})
boxed class to store validated Number payloads | + {{/or}} + {{#and (eq this "string") (neq ../format "binary") }} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}})
boxed class to store validated String payloads | + {{/and}} + {{#eq this "array"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}})
boxed class to store validated List payloads | + {{/eq}}{{#eq this "object"}} +| record | [{{../../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}})
boxed class to store validated Map payloads | + {{/eq}} + {{else}} +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}})
boxed class to store validated null payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}})
boxed class to store validated boolean payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}})
boxed class to store validated Number payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}})
boxed class to store validated String payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}})
boxed class to store validated List payloads | +| record | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}})
boxed class to store validated Map payloads | + {{/each}} + {{/eq}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces jsonPathPiece) }})
schema class | + {{else}} + {{#eq instanceType "propertiesOutputType"}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }})
output class for Map payloads | + {{else}} + {{#eq instanceType "arrayOutputType"}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }})
output class for List payloads | + {{else}} + {{#eq instanceType "arrayInputType"}} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{arrayInputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }})
builder for List payloads | + {{else}} + {{#or (eq instanceType "propertiesInputType") (eq instanceType "requiredPropertiesInputType") (eq instanceType "optionalPropertiesInputType") }} +| static class | [{{../containerJsonPathPiece.pascalCase}}.{{mapInputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }})
builder for Map payloads | + {{else}} + {{#eq instanceType "enumClass"}} + {{#with enumInfo}} + {{#each typeToValues}} + {{#eq @key "null"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})
null enum | + {{else}} + {{#eq @key "boolean"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})
boolean enum | + {{else}} + {{#eq @key "string"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})
String enum | + {{else}} + {{#eq @key "Integer"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})
Integer enum | + {{else}} + {{#eq @key "Long"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})
Long enum | + {{else}} + {{#eq @key "Float"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})
Float enum | + {{else}} + {{#eq @key "Double"}} +| enum | [{{../../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})
Double enum | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/with}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/each}} +{{#each (reverse getSchemas)}} + {{#eq instanceType "schema"}} + + {{#eq refInfo null}} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/_boxedClasses forDocs=true }} + {{/eq}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces jsonPathPiece) }} +class {{jsonPathPiece.pascalCase}}
+{{> src/main/kotlin/packagename/components/schemas/docschema_extends }} + +A schema class that validates payloads + {{#if description}} + +{{headerSize}}# Description +{{description.originalWithBr}} + {{/if}} + {{#if isCustomSchema}} + {{#if typeToExample}} + +{{headerSize}}## Code Sample +``` +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; +import {{{packageName}}}.{{../subpackage}}.{{../containerJsonPathPiece.pascalCase}}; + +import java.util.Arrays; +import java.util.List; +import java.util.AbstractMap; + +static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +{{> src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample payloadVarName="validatedPayload" configVarName="configuration" }} +``` + {{/if}} + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | ---------------------- | +{{> src/main/kotlin/packagename/components/schemas/docschema_fields forDocs=true }} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{> src/main/kotlin/packagename/components/schemas/docschema_io_types }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited }} + {{/if}} + {{else}} + {{#eq instanceType "propertiesOutputType"}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }} +class {{mapOutputJsonPathPiece.pascalCase}}
+extends FrozenMap src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Any{{/with}}> + +A class to store validated Map payloads + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | of([Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{else}}Any{{/with}}>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{#each requiredProperties}} + {{#if @key.isValid}} +| {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | {{@key.original}}()
{{> src/main/kotlin/packagename/components/schemas/helpers/notes_msg defaultUser="server" }} | + {{/if}} + {{/each}} + {{#each optionalProperties}} + {{#if @key.isValid}} +| {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | {{@key.original}}()
[optional]{{> src/main/kotlin/packagename/components/schemas/helpers/notes_msg defaultUser="server" }} | + {{/if}} + {{/each}} + {{#or (and requiredProperties requiredProperties.hasInvalidKey) (and optionalProperties optionalProperties.hasInvalidKey) }} +| {{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }}{{else}}Any{{/with}} | get(String key)
This schema has invalid Kotlin names so this method must be used when you access {{#each requiredProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}}{{#each optionalProperties}}{{#unless @key.isValid}}instance["{{@key.original}}"], {{/unless}}{{/each}} | + {{/or}} + {{#with additionalProperties}} + {{#unless isBooleanSchemaFalse}} + {{#if isBooleanSchemaTrue}} +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + {{else}} +| {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type sourceJsonPath=../jsonPath useLink=true }} | getAdditionalProperty(String name)
provides type safety for additional properties | + {{/if}} + {{/unless}} + {{else}} +| Any? | getAdditionalProperty(String name)
provides type safety for additional properties | + {{/with}} + {{else}} + {{#eq instanceType "arrayOutputType"}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }} +class {{arrayOutputJsonPathPiece.pascalCase}}
+extends `FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{else}}Any{{/with}}>` + +A class to store validated List payloads + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| static [{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}) | of([List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}) arg, SchemaConfiguration configuration) | + {{else}} + {{#eq instanceType "arrayInputType"}} +{{> src/main/kotlin/packagename/components/schemas/docschema_arrayInput }} + {{else}} + {{#or (eq instanceType "propertiesInputType") (eq instanceType "requiredPropertiesInputType") (eq instanceType "optionalPropertiesInputType") }} +{{> src/main/kotlin/packagename/components/schemas/docschema_objectInput }} + {{else}} + {{#eq instanceType "enumClass"}} + {{#with enumInfo}} + {{#each typeToValues}} + + {{#eq @key "null"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Null" ../jsonPathPiece.pascalCase "") ) }} +public enum Null{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores null enum values + {{else}} + {{#eq @key "boolean"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Boolean" ../jsonPathPiece.pascalCase "") ) }} +public enum Boolean{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores boolean enum values + {{else}} + {{#eq @key "string"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "String" ../jsonPathPiece.pascalCase "") ) }} +public enum String{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores String enum values + {{else}} + {{#eq @key "Integer"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Integer" ../jsonPathPiece.pascalCase "") ) }} +public enum Integer{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Integer enum values + {{else}} + {{#eq @key "Long"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Long" ../jsonPathPiece.pascalCase "") ) }} +public enum Long{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Long enum values + {{else}} + {{#eq @key "Float"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Float" ../jsonPathPiece.pascalCase "") ) }} +public enum Float{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Float enum values + {{else}} + {{#eq @key "Double"}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces (join "Double" ../jsonPathPiece.pascalCase "") ) }} +public enum Double{{../jsonPathPiece.pascalCase}}
+extends `Enum` + +A class that stores Double enum values + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + +{{headerSize}}## Enum Constant Summary +| Enum Constant | Description | +| ------------- | ----------- | + {{#each this}} + {{#eq ../@key "null"}} +| {{this}} | value = null | + {{else}} + {{#eq ../@key "boolean"}} +| {{this}} | value = {{@key.value}} | + {{else}} + {{#eq ../@key "string"}} +| {{this}} | value = "{{{@key.value}}}" | + {{else}} + {{#eq ../@key "Integer"}} +| {{this}} | value = {{@key.value}} | + {{else}} + {{#eq ../@key "Long"}} +| {{this}} | value = {{@key.value}}L | + {{else}} + {{#eq ../@key "Float"}} +| {{this}} | value = {{@key.value}}f | + {{else}} + {{#eq ../@key "Double"}} +| {{this}} | value = {{@key.value}}d | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/each}} + {{/with}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/each}} +{{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" schemasLink=true}} +{{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_getSchemas.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_getSchemas.hbs new file mode 100644 index 00000000000..2ff018c4ae3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/Schema_getSchemas.hbs @@ -0,0 +1,53 @@ +{{#each getSchemas}} + {{! generate all schemas in post order traversal }} + {{#eq instanceType "schema" }} +{{> src/main/kotlin/packagename/components/schemas/SchemaClass/SchemaClass identifierPieces=(append identifierPieces jsonPathPiece) }} + {{else}} + {{#eq instanceType "allOfType" }} +{{!> components/schemas/_allof_type }} + {{else}} + {{#eq instanceType "anyOfType" }} +{{!> components/schemas/_anyof_type }} + {{else}} + {{#eq instanceType "enumClass" }} +{{> src/main/kotlin/packagename/components/schemas/_enumTypes }} + {{else}} + {{#eq instanceType "oneOfType" }} +{{!> components/schemas/_oneof_type }} + {{else}} + {{#eq instanceType "propertiesType" }} +{{!> components/schemas/_properties_type }} + {{else}} + {{#eq instanceType "requiredPropertiesInputType" }} + {{! only required }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputType }} + {{else}} + {{! only optional }} + {{#eq instanceType "optionalPropertiesInputType" }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputType }} + {{else}} + {{! both required + optional }} + {{#eq instanceType "propertiesInputType" }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputType }} + {{else}} + {{#eq instanceType "propertiesOutputType" }} +{{> src/main/kotlin/packagename/components/schemas/_objectOutputType }} + {{else}} + {{#eq instanceType "arrayOutputType" }} +{{> src/main/kotlin/packagename/components/schemas/_arrayOutputType }} + {{else}} + {{#eq instanceType "arrayInputType" }} +{{> src/main/kotlin/packagename/components/schemas/_arrayInputType }} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs new file mode 100644 index 00000000000..ce2062575c9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputAddItem.hbs @@ -0,0 +1,269 @@ +{{#each types}} + {{#eq this "null"}} + {{#if forDocs }} +| {{builderClass}} | add(item: Nothing?) | + {{else}} + +fun add(item: Nothing?): {{builderClass}} { + list.add(null) + return this +} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if forDocs }} +| {{builderClass}} | add(item: Boolean) | + {{else}} + +fun add(item: Boolean): {{builderClass}} { + list.add(item) + return this +} + {{/if}} + {{else}} + {{#eq this "string"}} + {{#if forDocs }} +| {{builderClass}} | add(item: String) | + {{else}} + +fun add(item: String): {{builderClass}} { + list.add(item) + return this +} + {{/if}} + {{else}} + {{#or (eq this "integer") (eq this "number") }} + {{#if forDocs }} +| {{builderClass}} | add(item: Int) | +| {{builderClass}} | add(item: Float) | + {{#neq ../format "int32"}} +| {{builderClass}} | add(item: Long) | +| {{builderClass}} | add(item: Double) | + {{/neq}} + {{else}} + +fun add(item: Int): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: Float): {{builderClass}} { + list.add(item) + return this +} + {{#neq ../format "int32"}} + +fun add(item: Long): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: Double): {{builderClass}} { + list.add(item) + return this +} + {{/neq}} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if forDocs }} +| {{builderClass}} | add(item: List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | + {{else}} + +fun add(item: List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{builderClass}} { + list.add(item) + return this +} + {{/if}} + {{else}} + {{#eq this "object"}} + {{#if forDocs }} +| {{builderClass}} | add(item: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | + {{else}} + +fun add(item: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{builderClass}} { + list.add(item) + return this +} + {{/if}} + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} +{{else}} + {{! no type defined }} + {{#if forDocs }} +| {{builderClass}} | add(item: Nothing?) | +| {{builderClass}} | add(item: Boolean) | +| {{builderClass}} | add(item: String) | +| {{builderClass}} | add(item: Int) | +| {{builderClass}} | add(item: Float) | +| {{builderClass}} | add(item: Long) | +| {{builderClass}} | add(item: Double) | +| {{builderClass}} | add(item: List) | +| {{builderClass}} | add(item: Map) | + {{else}} + +fun add(item: Nothing?): {{builderClass}} { + list.add(null) + return this +} + +fun add(item: Boolean): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: String): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: Int): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: Float): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: Long): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: Double): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: List<*>): {{builderClass}} { + list.add(item) + return this +} + +fun add(item: Map): {{builderClass}} { + list.add(item) + return this +} + {{/if}} +{{/each}} +{{#with enumInfo}} + {{#each typeToValues }} + {{#eq @key "null"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}})) | + {{else}} +| {{builderClass}} | add(item: [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(null) + return this +} + {{/if}} + {{else}} + {{#eq @key "boolean"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}})) | + {{else}} +| {{builderClass}} | add(item: [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this +} + {{/if}} + {{else}} + {{#eq @key "string"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}})) | + {{else}} +| {{builderClass}} | add(item: [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this +} + {{/if}} + {{else}} + {{#eq @key "Integer"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}})) | + {{else}} +| {{builderClass}} | add(item: [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this +} + {{/if}} + {{else}} + {{#eq @key "Long"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}})) | + {{else}} +| {{builderClass}} | add(item: [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this +} + {{/if}} + {{else}} + {{#eq @key "Float"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}})) | + {{else}} +| {{builderClass}} | add(item: [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this +} + {{/if}} + {{else}} + {{#eq @key "Double"}} + {{#if forDocs }} + {{#if useContainer }} +| {{builderClass}} | add(item: [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}})) | + {{else}} +| {{builderClass}} | add(item: [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun add(item: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}}): {{builderClass}} { + list.add(item.value()) + return this +} + {{/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} +{{/with}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs new file mode 100644 index 00000000000..e5b8c31cad2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayInputType.hbs @@ -0,0 +1,36 @@ +{{#if listItemSchema}} + +class {{arrayInputJsonPathPiece.pascalCase}} { + // class to build List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> + private val list: MutableList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> + + init { + this.list = ArrayList() + } + + {{#with listItemSchema}} + {{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} + {{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../../arrayInputJsonPathPiece.pascalCase useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} + + fun add(item: List<*>): {{../arrayInputJsonPathPiece.pascalCase}} { + list.add(item) + return this + } + {{/if}} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../arrayInputJsonPathPiece.pascalCase }} + {{/if}} + {{else}} + {{! todo handle this, 3.1.0 document use-case }} + {{/with}} + + fun build(): List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}> { + return list + } +} +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs new file mode 100644 index 00000000000..3925993c65d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_arrayOutputType.hbs @@ -0,0 +1,10 @@ + + +class {{arrayOutputJsonPathPiece.pascalCase}}(m: FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}>) : FrozenList<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true }}{{/with}}>(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}>, configuration: SchemaConfiguration?): {{arrayOutputJsonPathPiece.pascalCase}} { + return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration) + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs new file mode 100644 index 00000000000..662585181e2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_containerClassName.hbs @@ -0,0 +1,98 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} + {{#if isBooleanSchemaTrue}} +{{containerJsonPathPiece.pascalCase}}: AnyTypeJsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}}: NotAnyTypeJsonSchema() + {{~/if}} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} +{{containerJsonPathPiece.pascalCase}}: AnyTypeJsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} +{{containerJsonPathPiece.pascalCase}}: MapJsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} +{{containerJsonPathPiece.pascalCase}}: ListJsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} +{{containerJsonPathPiece.pascalCase}}: BooleanJsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} + {{#if isSimpleInteger}} + {{#eq ../format "int32"}} +{{containerJsonPathPiece.pascalCase}}: Int32JsonSchema() + {{~else}} + {{#eq ../format "int64"}} +{{containerJsonPathPiece.pascalCase}}: Int64JsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}}: IntJsonSchema() + {{~/eq}} + {{/eq}} + {{~else}} +{{containerJsonPathPiece.pascalCase}}: NumberJsonSchema() + {{~/if}} + {{else}} +{{containerJsonPathPiece.pascalCase}} + {{~/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} + {{#eq ../format "date"}} +{{containerJsonPathPiece.pascalCase}}: DateJsonSchema() + {{~else}} + {{#eq ../format "date-time"}} +{{containerJsonPathPiece.pascalCase}}: DateTimeJsonSchema() + {{~else}} + {{#eq ../format "number"}} +{{containerJsonPathPiece.pascalCase}}: DecimalJsonSchema() + {{~else}} + {{#eq ../format "uuid"}} +{{containerJsonPathPiece.pascalCase}}: UuidJsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}}: StringJsonSchema() + {{~/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{else}} + {{#if isSimpleNull }} +{{containerJsonPathPiece.pascalCase}}: NullJsonSchema() + {{~else}} +{{containerJsonPathPiece.pascalCase}} + {{~/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +{{containerJsonPathPiece.pascalCase}} + {{~/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited.hbs new file mode 100644 index 00000000000..33afe89e125 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInherited.hbs @@ -0,0 +1,104 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} + {{#if isBooleanSchemaTrue}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="AnyTypeJsonSchema.AnyTypeJsonSchema1" }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1" }} + {{/if}} +{{else}} + {{#eq types null }} + {{#and isSimpleAnyType (eq refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="AnyTypeJsonSchema.AnyTypeJsonSchema1" }} + {{/and}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#and isSimpleObject (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="MapJsonSchema.MapJsonSchema1" }} + {{/and}} + {{else}} + {{#eq this "array"}} + {{#and isSimpleArray (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="ListJsonSchema.ListJsonSchema1" }} + {{/and}} + {{else}} + {{#eq this "boolean"}} + {{#and isSimpleBoolean (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="BooleanJsonSchema.BooleanJsonSchema1" }} + {{/and}} + {{else}} + {{#eq this "integer" }} + {{#and isSimpleInteger (eq ../refInfo null) }} + {{#eq ../format null }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="IntJsonSchema.IntJsonSchema1" }} + {{/eq}} + {{#eq ../format "int" }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="IntJsonSchema.IntJsonSchema1" }} + {{/eq}} + {{#eq ../format "int32"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int32JsonSchema.Int32JsonSchema1" }} + {{/eq}} + {{#eq ../format "int64"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int64JsonSchema.Int64JsonSchema1" }} + {{/eq}} + {{/and}} + {{else}} + {{#eq this "number" }} + {{#and isSimpleNumber (eq ../refInfo null) }} + {{#eq ../format null}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="NumberJsonSchema.NumberJsonSchema1" }} + {{else}} + {{#eq ../format "float"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="FloatJsonSchema.FloatJsonSchema1" }} + {{else}} + {{#eq ../format "double"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DoubleJsonSchema.DoubleJsonSchema1" }} + {{else}} + {{#eq ../format "int32"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int32JsonSchema.Int32JsonSchema1" }} + {{else}} + {{#eq ../format "int64"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="Int64JsonSchema.Int64JsonSchema1" }} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/and}} + {{else}} + {{#eq this "string"}} + {{#and isSimpleString (eq ../refInfo null) }} + {{#eq ../format null}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="StringJsonSchema.StringJsonSchema1" }} + {{/eq}} + {{#eq ../format "date"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DateJsonSchema.DateJsonSchema1" }} + {{/eq}} + {{#eq ../format "date-time"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DateTimeJsonSchema.DateTimeJsonSchema1" }} + {{/eq}} + {{#eq ../format "uuid"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="UuidJsonSchema.UuidJsonSchema1" }} + {{/eq}} + {{#eq ../format "number"}} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="DecimalJsonSchema.DecimalJsonSchema1" }} + {{/eq}} + {{/and}} + {{else}} + {{#and isSimpleNull (eq ../refInfo null) }} +{{> src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn className="NullJsonSchema.NullJsonSchema1" }} + {{/and}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn new file mode 100644 index 00000000000..5c630efde51 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_docschema_methodsInheritedFn @@ -0,0 +1,5 @@ + +| Methods Inherited from class {{packageName}}.schemas.{{className}} | +| ------------------------------------------------------------------ | +| validate | +| validateAndBox | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs new file mode 100644 index 00000000000..ce3c711afbe --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_enumTypes.hbs @@ -0,0 +1,110 @@ +{{#with enumInfo}} + {{#each typeToValues}} + + {{#eq @key "null"}} +enum class Null{{../jsonPathPiece.pascalCase}}(private val value: Nothing?): NullValueMethod { + {{else}} + {{#eq @key "boolean"}} +enum class Boolean{{../jsonPathPiece.pascalCase}}(private val value: Boolean): BooleanValueMethod { + {{else}} + {{#eq @key "string"}} +enum class String{{../jsonPathPiece.pascalCase}}(private val value: String): StringValueMethod { + {{else}} + {{#eq @key "Integer"}} +enum class Integer{{../jsonPathPiece.pascalCase}}(private val value: Int): IntegerValueMethod { + {{else}} + {{#eq @key "Long"}} +enum class Long{{../jsonPathPiece.pascalCase}}(private val value: Long): LongValueMethod { + {{else}} + {{#eq @key "Float"}} +enum class Float{{../jsonPathPiece.pascalCase}}(private val value: Float): FloatValueMethod { + {{else}} + {{#eq @key "Double"}} +enum class Double{{../jsonPathPiece.pascalCase}}(private val value: Double): DoubleValueMethod { + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{#each this}} + {{#eq ../@key "null"}} + {{this}}(null){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "boolean"}} + {{this}}({{@key.value}}){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "string"}} + {{this}}("{{{@key.value}}}"){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Integer"}} + {{this}}({{@key.value}}){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Long"}} + {{this}}({{@key.value}}L){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Float"}} + {{this}}({{@key.value}}f){{#unless @last}},{{else}};{{/unless}} + {{else}} + {{#eq ../@key "Double"}} + {{this}}({{@key.value}}){{#unless @last}},{{else}};{{/unless}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{#eq @key "null"}} + + override fun value(): Nothing? { + return this.value + } + {{else}} + {{#eq @key "boolean"}} + + override fun value(): Boolean { + return this.value + } + {{else}} + {{#eq @key "string"}} + + override fun value(): String { + return this.value + } + {{else}} + {{#eq @key "Integer"}} + + override fun value(): Int { + return this.value + } + {{else}} + {{#eq @key "Long"}} + + override fun value(): Long { + return this.value + } + {{else}} + {{#eq @key "Float"}} + + override fun value(): Float { + return this.value + } + {{else}} + {{#eq @key "Double"}} + + override fun value(): Double { + return this.value + } + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +} + {{/each}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs new file mode 100644 index 00000000000..3cc1974ef77 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter.hbs @@ -0,0 +1,349 @@ +{{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} + {{#with refInfo.ref }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter }} + {{/with}} + {{/if}} +{{else}} + {{#each types}} + {{#eq this "null"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Nothing?) | + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Boolean) | + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq this "string"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: String) | + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#or (eq this "integer") (eq this "number") }} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Float) | + {{#neq ../format "int32"}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Double) | + {{/neq}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + {{#neq ../format "int32"}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + {{/neq}} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq this "object"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{! no type defined }} + {{#if forDocs }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs }} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Nothing?): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: List): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{/each}} + {{#with enumInfo}} + {{#each typeToValues }} + {{#eq @key "null"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = null + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "boolean"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "string"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Integer"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Long"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Float"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Double"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +@Throws(InvalidAdditionalPropertyException::class) +fun {{methodName}}(key: String, value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}}): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs new file mode 100644 index 00000000000..8c7c994aceb --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs.hbs @@ -0,0 +1,9 @@ +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Nothing?) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Boolean) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: String) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Float) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Double) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: List) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(key: String, value: Map) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs new file mode 100644 index 00000000000..f3ebe457dd1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputSetter.hbs @@ -0,0 +1,307 @@ +{{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} + {{#with refInfo.ref }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter }} + {{/with}} + {{/if}} +{{else}} + {{#each types}} + {{#eq this "null"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Nothing?) | + {{else}} + +fun {{methodName}}(value: Nothing?): T { + val instance = getInstance() + instance["{{{key}}}"] = null + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Boolean) | + {{else}} + +fun {{methodName}}(value: Boolean): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq this "string"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: String) | + {{else}} + +fun {{methodName}}(value: String): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#or (eq this "integer") (eq this "number") }} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Float) | + {{#neq ../format "int32"}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Double) | + {{/neq}} + {{else}} + +fun {{methodName}}(value: Int): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Float): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + {{#neq ../format "int32"}} + +fun {{methodName}}(value: Long): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Double): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + {{/neq}} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | + {{else}} + +fun {{methodName}}(value: List<{{#with items}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq this "object"}} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>) | + {{else}} + +fun {{methodName}}(value: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{/eq}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{! no type defined }} + {{#if forDocs }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Nothing?) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Boolean) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: String) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Int) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Float) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Long) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Double) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: List) | +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: Map) | + {{else}} + +fun {{methodName}}(value: Nothing?): T { + val instance = getInstance() + instance["{{{key}}}"] = null + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Boolean): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: String): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Int): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Float): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Long): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Double): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: List): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + +fun {{methodName}}(value: Map): T { + val instance = getInstance() + instance["{{{key}}}"] = value + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{/each}} + {{#with enumInfo}} + {{#each typeToValues }} + {{#eq @key "null"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Null{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#null{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Null{{../jsonPathPiece.pascalCase}}](#null{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Null{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = null + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "boolean"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Boolean{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#boolean{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Boolean{{../jsonPathPiece.pascalCase}}](#boolean{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Boolean{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "string"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.String{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#string{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [String{{../jsonPathPiece.pascalCase}}](#string{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}String{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Integer"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Integer{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#integer{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Integer{{../jsonPathPiece.pascalCase}}](#integer{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Integer{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Long"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Long{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#long{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Long{{../jsonPathPiece.pascalCase}}](#long{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Long{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Float"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Float{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#float{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Float{{../jsonPathPiece.pascalCase}}](#float{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Float{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{else}} + {{#eq @key "Double"}} + {{#if forDocs }} + {{#if useContainer }} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [{{../../containerJsonPathPiece.pascalCase}}.Double{{../jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#double{{../jsonPathPiece.kebabCase}})) | + {{else}} +| [{{builderClass.pascalCase}}](#{{builderClass.kebabCase}}) | {{methodName}}(value: [Double{{../jsonPathPiece.pascalCase}}](#double{{../jsonPathPiece.kebabCase}})) | + {{/if}} + {{else}} + +fun {{methodName}}(value: {{#if useContainer}}{{../../containerJsonPathPiece.pascalCase}}.{{/if}}Double{{../jsonPathPiece.pascalCase}}): T { + val instance = getInstance() + instance["{{{key}}}"] = value.value() + return {{getBuilderMethod}}(instance) +} + {{/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/with}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs new file mode 100644 index 00000000000..dd3521f8551 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectInputType.hbs @@ -0,0 +1,106 @@ +{{#each requiredProperties}} + +interface SetterFor{{@key.pascalCase}} { + fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + fun getBuilderAfter{{@key.pascalCase}}(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T + {{#if @key.isValid}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.original getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.camelCase getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{/if}} +} +{{/each}} +{{#each optionalProperties}} + +interface SetterFor{{@key.pascalCase}} { + fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + fun getBuilderAfter{{@key.pascalCase}}(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T + {{#if @key.isValid}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.original getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/_objectInputSetter methodName=@key.camelCase getBuilderMethod=(join "getBuilderAfter" @key.pascalCase "") key=@key.original }} + {{/if}} +} +{{/each}} +{{#with additionalProperties }} + {{#eq isBooleanSchemaFalse false}} + +interface SetterFor{{jsonPathPiece.pascalCase}} { + fun getKnownKeys(): Set + fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + fun getBuilderAfterAdditionalProperty(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): T + {{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter methodName="additionalProperty" getBuilderMethod="getBuilderAfterAdditionalProperty" }} +} + {{/eq}} +{{/with}} +{{#each mapBuilders}} + +class {{className.pascalCase}}{{#unless @last }}(private val instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>){{/unless}}: {{#and @first (eq ../additionalProperties null) }}UnsetAddPropsSetter<{{className.pascalCase}}>, {{/and}}{{#if @first}}GenericBuilder src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>>{{#if ../optionalProperties}}, {{/if}}{{/if}}{{#each keyToBuilder}}SetterFor{{@key.pascalCase}}<{{builder.className.pascalCase}}>{{#unless @last}}, {{/unless}}{{/each}}{{#and @first ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false) }}, SetterFor{{../additionalProperties.jsonPathPiece.pascalCase}}<{{className.pascalCase}}>{{/and}} { + {{#if @first}} + {{#and (eq ../requiredProperties null) (eq ../optionalProperties null) }} + private val knownKeys: Set = setOf() + {{else}} + {{#eq ../optionalProperties null }} + private val knownKeys: Set = setOf( + {{#each ../requiredProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) + {{else}} + {{#eq ../requiredProperties null }} + private val knownKeys: Set = setOf( + {{#each ../optionalProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) + {{else}} + private val knownKeys: Set = setOf( + {{#each ../requiredProperties}} + "{{{@key.original}}}", + {{/each}} + {{#each ../optionalProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) + {{/eq}} + {{/eq}} + {{/and}} + {{#unless ../additionalProperties.isBooleanSchemaFalse}} + override fun getKnownKeys(): Set { + return knownKeys + } + {{/unless}} + {{/if}} + {{#if @last }} + private val instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> + init { + this.instance = LinkedHashMap() + } + {{/if}} + {{#if @first}} + override fun build(): Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> { + return instance + } + {{/if}} + {{#or (eq keyToBuilder.isEmpty false) (and @first ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false)) (and @first (eq ../additionalProperties null)) }} + override fun getInstance(): MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> { + return instance + } + {{/or}} + {{#each keyToBuilder}} + override fun getBuilderAfter{{@key.pascalCase}}(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{builder.className.pascalCase}} { + {{#eq builder ../this}} + {{! property in final builder }} + return this + {{else}} + return {{builder.className.pascalCase}}(instance) + {{/eq}} + } + {{/each}} + {{#and @first (or (and ../additionalProperties (eq ../additionalProperties.isBooleanSchemaFalse false)) (eq ../additionalProperties null)) }} + override fun getBuilderAfterAdditionalProperty(instance: MutableMap src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>): {{className.pascalCase}} { + return this + } + {{/and}} +} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs new file mode 100644 index 00000000000..5cb6133f8d1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty.hbs @@ -0,0 +1,31 @@ +{{#if required}} + {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} + {{#contains ../../mapValueSchema "null"}} +return get("{{{@key.original}}}") + {{else}} +try { + return getOrThrow("version") +} catch (e: UnsetPropertyException) { + throw RuntimeException(e) +} + {{/contains}} + {{else}} +val value: {{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} = get("{{{@key.original}}}") +if (!({{#contains types "null" }}value == null || {{/contains}}value is {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw RuntimeException("Invalid value stored for {{{@key.original}}}") +} +return value + {{/and}} +{{else}} + {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} +return getOrThrow("{{{@key.original}}}") + {{else}} +val key = "{{{@key.original}}}" +throwIfKeyNotPresent(key) +val value: {{#with ../../mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }}{{/with}} = get(key) +if (!({{#contains types "null" }}value == null || {{/contains}}value is {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw RuntimeException("Invalid value stored for {{{@key.original}}}") +} +return value + {{/and}} +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs new file mode 100644 index 00000000000..4c0080decc4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputProperties.hbs @@ -0,0 +1,81 @@ +{{#if requiredProperties}} + {{#each requiredProperties}} + {{#if @key.isValid}} + {{#with this}} + {{#if refInfo.refClass}} + +fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" }} { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} +} + {{else}} + {{#if jsonPathPiece}} + +fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule=null }} { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} +} + {{else}} + {{! for when additionalProperties is unset, use OUTPUT_BASE_TYPES }} + +fun {{@key.original}}(): Any? { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=true }} +} + {{/if}} + {{/if}} + {{/with}} + {{/if}} + {{/each}} +{{/if}} +{{#if optionalProperties}} + {{#each optionalProperties}} + {{#if @key.isValid}} + {{#with this}} + +@Throws(UnsetPropertyException::class) +fun {{{@key.original}}}(): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type noAnnotations=true }} { + {{> src/main/kotlin/packagename/components/schemas/_objectOutputGetProperty required=false }} +} + {{/with}} + {{/if}} + {{/each}} +{{/if}} +{{#eq additionalProperties null }} + +@Throws(UnsetPropertyException::class, InvalidAdditionalPropertyException::class) +fun getAdditionalProperty(name: String): Any? { + {{#or optionalProperties requiredProperties}} + throwIfKeyKnown(name, requiredKeys, optionalKeys) + {{/or}} + throwIfKeyNotPresent(name) + return get(name) +} +{{else}} + {{#with additionalProperties}} + {{#unless isBooleanSchemaFalse}} + +@Throws(UnsetPropertyException::class{{#or ../optionalProperties ../requiredProperties}}, InvalidAdditionalPropertyException::class{{/or}}) +fun getAdditionalProperty(name: String): {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type }} { + {{#or ../optionalProperties ../requiredProperties}} + throwIfKeyKnown(name, requiredKeys, optionalKeys) + {{/or}} + {{#and ../../mapValueSchema (eq typeSchema ../../mapValueSchema.typeSchema) }} + {{#and (neq types null) (eq types.size 1) (contains types "boolean") }} + throwIfKeyNotPresent(name) + val value: Boolean? = get(name) + if (value == null) { + throw RuntimeException("Value may not be null") + } + return value + {{else}} + return getOrThrow(name) + {{/and}} + {{else}} + val value = getOrThrow(name) + if (!({{#contains types "null" }}value == null || {{/contains}}value is {{> src/main/kotlin/packagename/components/schemas/types/schema_output_type fullRefModule="" forceNull=true noAnnotations=true }})) { + throw RuntimeException("Invalid value stored for " + name) + } + return value + {{/and}} +} + {{/unless}} + {{/with}} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs new file mode 100644 index 00000000000..3d814933cf2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_objectOutputType.hbs @@ -0,0 +1,48 @@ + + +{{#if mapValueSchema}} +class {{mapOutputJsonPathPiece.pascalCase}}(m: FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}>) : FrozenMap<{{#with mapValueSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_output_type forceNull=true }}{{/with}}>(m) { +{{else}} +class {{mapOutputJsonPathPiece.pascalCase}}(m: FrozenMap): FrozenMap(m) { +{{/if}} + companion object { + {{#if requiredProperties}} + val requiredKeys: Set = setOf( + {{#each requiredProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) + {{else}} + val requiredKeys: Set = setOf() + {{/if}} + {{#if optionalProperties}} + val optionalKeys: Set = setOf( + {{#each optionalProperties}} + "{{{@key.original}}}"{{#unless @last}},{{/unless}} + {{/each}} + ) + {{else}} + val optionalKeys: Set = setOf() + {{/if}} + {{#eq optionalProperties null}} + {{#eq requiredProperties null}} + {{#if additionalProperties}} + {{#if additionalProperties.isBooleanSchemaFalse}} + // map with no key value pairs + {{/if}} + {{/if}} + {{/eq}} + {{/eq}} + @Throws(ValidationException::class) + {{#if mapValueSchema}} + fun of(arg: Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true }}{{/with}}>, configuration: SchemaConfiguration): {{mapOutputJsonPathPiece.pascalCase}} { + return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration) + } + {{else}} + fun of(arg: Map, configuration: SchemaConfiguration): {{mapOutputJsonPathPiece.pascalCase}} { + return {{jsonPathPiece.pascalCase}}.getInstance().validate(arg, configuration) + } + {{/if}} + } + {{> src/main/kotlin/packagename/components/schemas/_objectOutputProperties }} +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_sealedClassName.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_sealedClassName.hbs new file mode 100644 index 00000000000..54f69f6b66f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/_sealedClassName.hbs @@ -0,0 +1,43 @@ +{{#if isCustomSchema}} + {{#if forDocs}} +[{{jsonPathPiece.pascalCase}}Boxed]({{docRoot}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}boxed) + {{~else}} +{{jsonPathPiece.pascalCase}}Boxed + {{~/if}} +{{~else}} + {{#or isBooleanSchemaTrue isSimpleAnyType}} +AnyTypeJsonSchema1Boxed + {{~else}} + {{#if isBooleanSchemaFalse}} +NotAnyTypeJsonSchema1Boxed + {{~else}} + {{#if isSimpleObject}} +MapJsonSchema1Boxed + {{~else}} + {{#if isSimpleArray}} +ListJsonSchema1Boxed + {{~else}} + {{#if isSimpleBoolean}} +BooleanJsonSchema1Boxed + {{~else}} + {{#if isSimpleInteger}} +IntJsonSchema1Boxed + {{~else}} + {{#if isSimpleNumber}} +NumberJsonSchema1Boxed + {{~else}} + {{#if isSimpleString}} +StringJsonSchema1Boxed + {{~else}} + {{#if isSimpleNull}} +NullJsonSchema1Boxed + {{~/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{/or}} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs new file mode 100644 index 00000000000..56fac34c805 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_arrayInput.hbs @@ -0,0 +1,33 @@ + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }} +class {{arrayInputJsonPathPiece.pascalCase}}
+builder for `List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}>` + +A class that builds the List input type + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{arrayInputJsonPathPiece.pascalCase}}()
Creates an empty list | +| {{arrayInputJsonPathPiece.pascalCase}}(List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> items)
Stores the items in a list | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#with listItemSchema}} + {{#if refInfo }} + {{#if refInfo.refModule}} + {{#with getDeepestRef }} +{{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../../arrayInputJsonPathPiece.pascalCase forDocs=true useContainer=true }} + {{/with}} + {{else}} + {{! self reference} }} +| {{../arrayInputJsonPathPiece.pascalCase}} | add(List<*> item) | + {{/if}} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_arrayInputAddItem builderClass=../arrayInputJsonPathPiece.pascalCase forDocs=true }} + {{/if}} +{{else}} +{{! todo handle this, 3.1.0 document use-case }} +{{/with}} +| List<{{#with listItemSchema}}{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> | build()
Returns list input that should be used with Schema.validate | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends.hbs new file mode 100644 index 00000000000..5684b18ff43 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends.hbs @@ -0,0 +1,66 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{else}} + {{#if isSimpleNull }} +{{> src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass }} + {{else}} +extends JsonSchema + {{/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +extends JsonSchema + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass.hbs new file mode 100644 index 00000000000..1828408b693 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_extends_varEqualsClass.hbs @@ -0,0 +1,88 @@ +{{#or isBooleanSchemaTrue isBooleanSchemaFalse}} + {{#if isBooleanSchemaTrue}} +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + {{else}} +extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1 + {{/if}} +{{else}} + {{#if refInfo.refClass}} + {{#if refInfo.refModule}} +extends [{{refInfo.refModule}}.{{refInfo.refClass}}]({{docRoot}}{{#with refInfo.ref}}{{pathFromDocRoot}}.md#{{jsonPathPiece.kebabCase}}{{/with}}) + {{else}} +extends [{{refInfo.refClass}}](#{{refInfo.ref.jsonPathPiece.kebabCase}}) + {{/if}} + {{else}} + {{#eq types null}} +extends AnyTypeJsonSchema.AnyTypeJsonSchema1 + {{else}} + {{#each types}} + {{#eq this "null"}} +extends NullJsonSchema.NullJsonSchema1 + {{/eq}} + {{#eq this "object"}} +extends MapJsonSchema.MapJsonSchema1 + {{/eq}} + {{#eq this "array"}} +extends ListJsonSchema.ListJsonSchema1 + {{/eq}} + {{#eq this "boolean"}} +extends BooleanJsonSchema.BooleanJsonSchema1 + {{/eq}} + {{#eq this "string"}} + {{#eq ../format "date"}} +extends DateJsonSchema.DateJsonSchema1 + {{/eq}} + {{#eq ../format "date-time"}} +extends DateTimeJsonSchema.DateTimeJsonSchema1 + {{/eq}} + {{#eq ../format "uuid"}} +extends UuidJsonSchema.UuidJsonSchema1 + {{/eq}} + {{#eq ../format "number"}} +extends DecimalJsonSchema.DecimalJsonSchema1 + {{/eq}} + {{#eq ../format "binary"}} +extends JsonSchema + {{/eq}} + {{#neq ../format "date"}} + {{#neq ../format "date-time"}} + {{#neq ../format "uuid"}} + {{#neq ../format "number"}} + {{#neq ../format "binary"}} +extends StringJsonSchema.StringJsonSchema1 + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "integer"}} + {{#eq ../format "int32"}} +extends Int32JsonSchema.Int32JsonSchema1 + {{/eq}} + {{#eq ../format "int64"}} +extends Int64JsonSchema.Int64JsonSchema1 + {{/eq}} + {{#neq ../format "int32"}} + {{#neq ../format "int64"}} +extends IntJsonSchema.IntJsonSchema1 + {{/neq}} + {{/neq}} + {{/eq}} + {{#eq this "number"}} + {{#eq ../format null}} +extends NumberJsonSchema.NumberJsonSchema1 + {{else}} + {{#eq ../format "float"}} +extends FloatJsonSchema.FloatJsonSchema1 + {{else}} + {{#eq ../format "double"}} +extends DoubleJsonSchema.DoubleJsonSchema1 + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{/eq}} + {{/if}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields.hbs new file mode 100644 index 00000000000..d89246c839a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields.hbs @@ -0,0 +1,58 @@ +{{#or isBooleanSchemaFalse isBooleanSchemaTrue}} +{{else}} + {{#eq types null }} + {{#if isSimpleAnyType }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{! types exist }} + {{#eq types.size 1}} + {{! one type }} + {{#each types}} + {{#eq this "object"}} + {{#if isSimpleObject }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#eq this "array"}} + {{#if isSimpleArray }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#eq this "boolean"}} + {{#if isSimpleBoolean }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#or (eq this "number") (eq this "integer") }} + {{#or isSimpleInteger isSimpleNumber }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/or}} + {{else}} + {{#eq this "string"}} + {{#if isSimpleString}} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{else}} + {{#if isSimpleNull }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/if}} + {{/eq}} + {{/or}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! multiple types }} +{{> src/main/kotlin/packagename/components/schemas/docschema_fields_field }} + {{/eq}} + {{/eq}} +{{/or}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs new file mode 100644 index 00000000000..f3d44571e5a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_fields_field.hbs @@ -0,0 +1,117 @@ +{{#if types}} +| Set> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_types }} | +{{/if}} +{{#if format}} +| String | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_format }} | +{{/if}} +{{#if items}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_items }} | +{{/if}} +{{#if properties}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_properties }} | +{{/if}} +{{#if requiredProperties}} +| Set | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_required }} | +{{/if}} +{{#neq exclusiveMaximum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMaximum }} | +{{/neq}} +{{#neq exclusiveMinimum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_exclusiveMinimum }} | +{{/neq}} +{{#neq maximum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maximum }} | +{{/neq}} +{{#neq minimum null}} +| Number | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minimum }} | +{{/neq}} +{{#neq multipleOf null}} +| BigDecimal | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_multipleOf }} | +{{/neq}} +{{#neq maxItems null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxItems }} | +{{/neq}} +{{#neq minItems null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minItems }} | +{{/neq}} +{{#neq maxLength null }} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxLength }} | +{{/neq}} +{{#neq minLength null }} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minLength }} | +{{/neq}} +{{#neq maxProperties null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxProperties }} | +{{/neq}} +{{#neq minProperties null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minProperties }} | +{{/neq}} +{{#if additionalProperties}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_additionalProperties }} | +{{/if}} +{{#if allOf}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_allOf }} | +{{/if}} +{{#if anyOf}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_anyOf }} | +{{/if}} +{{#if oneOf}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_oneOf }} | +{{/if}} +{{#if not}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_not }} | +{{/if}} +{{#neq uniqueItems null}} +| Boolean | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_uniqueItems }} | +{{/neq}} +{{#if enumInfo}} +| Set | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_enum }} | +{{/if}} +{{#if patternInfo}} +| Pattern | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_pattern }} | +{{/if}} +{{#if defaultValue}} +| Any? | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_default }} | +{{/if}} +{{#if contains}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_contains }} | +{{/if}} +{{#neq maxContains null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_maxContains }} | +{{/neq}} +{{#neq minContains null}} +| Integer | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_minContains }} | +{{/neq}} +{{#if propertyNames}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_propertyNames }} | +{{/if}} +{{#if dependentRequired}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentRequired }} | +{{/if}} +{{#if dependentSchemas}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_dependentSchemas }} | +{{/if}} +{{#if patternProperties}} +| Map> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_patternProperties }} | +{{/if}} +{{#if prefixItems}} +| List> | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_prefixItems }} | +{{/if}} +{{#if if_}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_if }} | +{{/if}} +{{#if then}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_then }} | +{{/if}} +{{#if else_}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_else }} | +{{/if}} +{{#if constInfo}} +| Any? | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_const }} | +{{/if}} +{{#if unevaluatedItems}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedItems }} | +{{/if}} +{{#if unevaluatedProperties}} +| Class | {{> src/main/kotlin/packagename/components/schemas/SchemaClass/_unevaluatedProperties }} | +{{/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs new file mode 100644 index 00000000000..ad6957e8a82 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_io_types.hbs @@ -0,0 +1,122 @@ +{{#eq types null}} +| String | validate(arg: String, configuration: SchemaConfiguration) | + {{#and enumInfo enumInfo.typeToValues.string}} +| String | validate(arg: [String{{enumInfo.jsonPathPiece.pascalCase}}](#string{{enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | + {{/and}} +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | + {{#and enumInfo enumInfo.typeToValues.null}} +| Nothing? | validate(arg: [Null{{enumInfo.jsonPathPiece.pascalCase}}](#null{{enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | + {{/and}} +| int | validate(arg: int, configuration: SchemaConfiguration) | +| long | validate(arg: long, configuration: SchemaConfiguration) | +| float | validate(arg: float, configuration: SchemaConfiguration) | +| double | validate(arg: double, configuration: SchemaConfiguration) | +| Number | validate(arg: Number, configuration: SchemaConfiguration) | +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | + {{#and enumInfo enumInfo.typeToValues.boolean}} +| boolean | validate(arg: [Boolean{{enumInfo.jsonPathPiece.pascalCase}}](#boolean{{enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | + {{/and}} + {{#if mapOutputJsonPathPiece }} +| [{{mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapOutputJsonPathPiece) }}) | validate(arg: [Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}), configuration: SchemaConfiguration) | + {{else}} +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | + {{/if}} + {{#if arrayOutputJsonPathPiece}} +| [{{arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayOutputJsonPathPiece) }}) | validate(arg: [List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}), configuration: SchemaConfiguration) | + {{else}} +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | + {{/if}} +| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}}, configuration: SchemaConfiguration) | +| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List<*>{{/if}}, configuration: SchemaConfiguration) | +{{else}} + {{#each types}} + {{#eq this "boolean"}} +| boolean | validate(arg: boolean, configuration: SchemaConfiguration) | + {{#and ../enumInfo enumInfo.typeToValues.boolean}} +| boolean | validate(arg: [Boolean{{../enumInfo.jsonPathPiece.pascalCase}}](#boolean{{../enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | + {{/and}} +| [{{jsonPathPiece.pascalCase}}BoxedBoolean](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedboolean" ""))}}) | validateAndBox(boolean, configuration: SchemaConfiguration) | + {{else}} + {{#eq this "null"}} +| Nothing? | validate(arg: Nothing?, configuration: SchemaConfiguration) | + {{#and ../enumInfo ../enumInfo.typeToValues.null}} +| Nothing? | validate(arg: [Null{{../enumInfo.jsonPathPiece.pascalCase}}](#null{{../enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | + {{/and}} +| [{{jsonPathPiece.pascalCase}}BoxedVoid](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedvoid" ""))}}) | validateAndBox(Nothing?, configuration: SchemaConfiguration) | + {{else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +| BinaryString | validate(arg: BinaryString, configuration: SchemaConfiguration) | + {{else}} +| String | validate(arg: String, configuration: SchemaConfiguration) | + {{#and ../enumInfo ../enumInfo.typeToValues.string}} +| String | validate(arg: [String{{../enumInfo.jsonPathPiece.pascalCase}}](#string{{../enumInfo.jsonPathPiece.kebabCase}}), configuration: SchemaConfiguration) | + {{/and}} +| [{{jsonPathPiece.pascalCase}}BoxedString](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedstring" ""))}}) | validateAndBox(String, configuration: SchemaConfiguration) | + {{/eq}} + {{else}} + {{#eq this "number"}} + {{#eq ../format null}} +| Number | validate(arg: Number, configuration: SchemaConfiguration) | + {{else}} + {{#eq ../format "float"}} +| float | validate(arg: float, configuration: SchemaConfiguration) | + {{else}} + {{#eq ../format "double"}} +| double | validate(arg: double, configuration: SchemaConfiguration) | + {{else}} + {{#eq ../format "int32"}} +| int | validate(arg: int, configuration: SchemaConfiguration) | + {{else}} + {{#eq ../format "int64"}} +| long | validate(arg: long, configuration: SchemaConfiguration) | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number, configuration: SchemaConfiguration) | + {{else}} + {{#eq this "integer"}} + {{#eq ../format null}} +| long | validate(arg: long, configuration: SchemaConfiguration) | + {{else}} + {{#eq ../format "int32"}} +| int | validate(arg: int, configuration: SchemaConfiguration) | + {{else}} +| long | validate(arg: long, configuration: SchemaConfiguration) | + {{/eq}} + {{/eq}} +| [{{jsonPathPiece.pascalCase}}BoxedNumber](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxednumber" ""))}}) | validateAndBox(Number, configuration: SchemaConfiguration) | + {{else}} + {{#eq this "array"}} + {{#if ../arrayOutputJsonPathPiece}} +| [{{../arrayOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../arrayOutputJsonPathPiece) }}) | validate(arg: [List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}), configuration: SchemaConfiguration) | + {{else}} +| FrozenList | validate(arg: List<*>, configuration: SchemaConfiguration) | + {{/if}} +| [{{jsonPathPiece.pascalCase}}BoxedList](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedlist" ""))}}) | validateAndBox({{#if arrayInputJsonPathPiece}}[List<*>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces arrayInputJsonPathPiece) }}){{else}}List<*>{{/if}}, configuration: SchemaConfiguration) | + {{else}} + {{#eq this "object"}} + {{#if ../mapOutputJsonPathPiece}} +| [{{../mapOutputJsonPathPiece.pascalCase}}](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapOutputJsonPathPiece) }}) | validate(arg: [Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces ../mapInputJsonPathPiece) }}), configuration: SchemaConfiguration) | + {{else}} +| FrozenMap | validate(arg: Map<?, ?>, configuration: SchemaConfiguration) | + {{/if}} +| [{{jsonPathPiece.pascalCase}}BoxedMap](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxedmap" ""))}}) | validateAndBox({{#if mapInputJsonPathPiece}}[Map<?, ?>](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces mapInputJsonPathPiece) }}){{else}}Map<?, ?>{{/if}}, configuration: SchemaConfiguration) | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} +{{/eq}} +| [{{jsonPathPiece.pascalCase}}Boxed](#{{> src/main/kotlin/packagename/components/_helper_anchor_id identifierPieces=(append identifierPieces (join jsonPathPiece.kebabCase "boxed" ""))}}) | validateAndBox(Any?, configuration: SchemaConfiguration) | +| Any? | validate(arg: Any?, configuration: SchemaConfiguration) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs new file mode 100644 index 00000000000..92abc1821c3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/docschema_objectInput.hbs @@ -0,0 +1,48 @@ +{{#each mapBuilders}} + +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces headerSize=(join headerSize "#" "") identifierPieces=(append identifierPieces className) }} +class {{className.pascalCase}}
+ {{#if ../mapValueSchema}} +builder for `Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../jsonPath forceNull=true noExtends=true }}{{/with}}>` + {{else}} +builder for `Map` + {{/if}} + +A class that builds the Map input type + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#if @last }} +| {{className.pascalCase}}()
Creates a builder that contains an empty map | + {{else}} +| {{className.pascalCase}}(Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> instance)
Creates a builder that contains the passed instance | + {{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | + {{#if @first}} +| Map src/main/kotlin/packagename/components/schemas/types/schema_input_type sourceJsonPath=../../jsonPath forceNull=true noExtends=true }}{{else}}Any?{{/with}}> | build()
Returns map input that should be used with Schema.validate | + {{/if}} + {{#each keyToBuilder}} + {{#with property }} + {{#if ../@key.isValid}} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter forDocs=true builderClass=../builder.className methodName=../@key.original }} + {{else}} +{{> src/main/kotlin/packagename/components/schemas/_objectInputSetter forDocs=true builderClass=../builder.className methodName=../@key.camelCase }} + {{/if}} + {{/with}} + {{/each}} + {{#if @first}} + {{#eq ../additionalProperties null }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropUnsetSetterDocs builderClass=className methodName="additionalProperty" }} + {{else}} + {{#eq ../additionalProperties.isBooleanSchemaFalse false }} + {{#with ../additionalProperties }} +{{> src/main/kotlin/packagename/components/schemas/_objectInputAddPropSetter forDocs=true builderClass=../className methodName="additionalProperty" }} + {{/with}} + {{/eq}} + {{/eq}} + {{/if}} +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/notes_msg.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/notes_msg.hbs new file mode 100644 index 00000000000..950442c4104 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/notes_msg.hbs @@ -0,0 +1 @@ +{{#unless refInfo.refClass}}{{#if enumInfo}} must be one of [{{#each enumInfo.valueToName}}{{#unless @first}}, {{/unless}}{{#eq @key.type "null"}}None{{/eq}}{{#eq @key.type "boolean"}}{{#if @key.value}}True{{else}}False{{/if}}{{/eq}}{{#eq @key.type "string"}}"{{{@key.value}}}"{{/eq}}{{#eq @key.type "number"}}{{{@key.value}}}{{/eq}}{{#eq @key.type "integer"}}{{{@key.value}}}{{/eq}}{{/each}}]{{/if}}{{#if defaultValue}}{{#unless requiredProperties}} if omitted the {{defaultUser}} will use the default value of {{{defaultValue.value}}}{{/unless}}{{/if}}{{#eq format "uuid"}} value must be a uuid{{/eq}}{{#eq format "date"}} value must conform to RFC-3339 full-date YYYY-MM-DD{{/eq}}{{#eq format "date-time"}} value must conform to RFC-3339 date-time{{/eq}}{{#eq format "number"}} value must be int or float numeric{{/eq}}{{#eq format "int32"}} value must be a 32 bit integer{{/eq}}{{#eq format "int64"}} value must be a 64 bit integer{{/eq}}{{#eq format "double"}} value must be a 64 bit float{{/eq}}{{#eq format "float"}} value must be a 32 bit float{{/eq}}{{/unless}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs new file mode 100644 index 00000000000..1ab042bffce --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/helpers/payload_renderer.hbs @@ -0,0 +1,96 @@ +{{#eq type "object"}} + {{#if constructor}} + {{#each value}} + {{#or (eq type "array") (eq type "object")}} + {{#or (and optionalProperties (contains optionalProperties @key)) (and requiredProperties (contains requiredProperties @key)) }} +.{{#if @key.isValid}}{{{@key.original}}}{{else}}{{{@key.camelCase}}}{{/if}}( + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true constructor=false }} +) + {{else}} +.additionalProperty( + "{{{@key.original}}}", + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true constructor=false }} +) + {{/or}} + {{else}} + {{#or (and optionalProperties (contains optionalProperties @key)) (and requiredProperties (contains requiredProperties @key)) }} +.{{#if @key.isValid}}{{{@key.original}}}{{else}}{{{@key.camelCase}}}{{/if}}({{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar=")" noVoid=true constructor=false }} + {{else}} +.additionalProperty("{{{@key.original}}}", {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar=")" noVoid=true constructor=false }} + {{/or}} + {{/or}} + {{/each}} + {{else}} +mapOf{{#eq value.size 0}}{{/eq}}( + {{#each value}} + Pair( + {{#if @key.original }} + "{{{@key.original}}}", + {{else}} + "{{{@key}}}", + {{/if}} + {{#with this}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true }} + {{/with}} + ){{#unless @last}},{{/unless}} + {{/each}} +){{endChar}} + {{/if}} +{{/eq}} +{{#eq type"array"}} + {{#if constructor}} + {{#each value}} + {{#or (eq type "array") (eq type "object")}} +.add( + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=false }} +) + {{else}} +.add({{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar=")" constructor=false }} + {{/or}} + {{/each}} + {{else}} +listOf{{#eq value.size 0}}{{/eq}}( + {{#eq value.size 1}} + {{#each value}} + {{! list with single null needs to describe the item as (Nothing?) }} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" }} + {{/each}} + {{else}} + {{#each value}} + {{#unless @last}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," noVoid=true }} + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" noVoid=true }} + {{/unless}} + {{/each}} + {{/eq}} +){{endChar}} + {{/if}} +{{/eq}} +{{#eq type "number"}} + {{#eq javaType "Long"}} +{{value}}L{{endChar}} + {{else}} + {{#eq javaType "Float"}} +{{value}}f{{endChar}} + {{else}} + {{#eq javaType "Double"}} +{{value}}{{endChar}} + {{else}} +{{value}}{{endChar}}{{! Integer }} + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} +{{#eq type "integer"}} +{{value}}{{#eq javaType "Long"}}L{{/eq}}{{endChar}} +{{/eq}} +{{#eq type "boolean"}} +{{value}}{{endChar}} +{{/eq}} +{{#eq type "null"}} +null{{endChar}} +{{/eq}} +{{#eq type "string"}} +"{{{value}}}"{{endChar}} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs new file mode 100644 index 00000000000..476fdf9047a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base.hbs @@ -0,0 +1,122 @@ +{{#if types}} + {{#eq types.size 1}} + {{#each types}} + {{#eq this "boolean"}} +Boolean + {{~else}} + {{#eq this "null"}} +Nothing? + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +String + {{~else}} +String + {{~/eq}} + {{else}} + {{#eq this "number"}} +Number + {{~else}} + {{#eq this "integer"}} +Number + {{~else}} + {{#eq this "array"}} + {{#eq ../jsonPath sourceJsonPath}} +List + {{~else}} + {{#with items}} +List<{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> + {{~else}} +List + {{~/with}} + {{/eq}} + {{else}} + {{#eq this "object"}} + {{#eq ../jsonPath sourceJsonPath}} +Map + {{~else}} + {{#with mapValueSchema}} +Map src/main/kotlin/packagename/components/schemas/types/schema_input_type }}> + {{~else}} +Map + {{~/with}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{#eq types.size 2}} + {{#contains types "null"}} + {{! nullable types }} + {{#each types}} + {{#eq this "boolean"}} +{{#unless noExtends}}out {{/unless}} Boolean? + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +{{#unless noExtends}}out {{/unless}} String? + {{~else}} +{{#unless noExtends}}out {{/unless}}String? + {{~/eq}} + {{else}} + {{#eq this "number"}} +{{#unless noExtends}}out {{/unless}} Number? + {{~else}} + {{#eq this "integer"}} +{{#unless noExtends}}out {{/unless}} Number? + {{~else}} + {{#eq this "array"}} + {{#eq ../jsonPath sourceJsonPath}} +{{#unless noExtends}}out {{/unless}} List? + {{~else}} + {{#with items}} +{{#unless noExtends}}out {{/unless}} List<{{> src/main/kotlin/packagename/components/schemas/types/schema_input_type }}>? + {{~else}} +{{#unless noExtends}}out {{/unless}} List? + {{~/with}} + {{/eq}} + {{else}} + {{#eq this "object"}} + {{#eq ../jsonPath sourceJsonPath}} +{{#unless noExtends}}out {{/unless}} Map? + {{~else}} + {{#with mapValueSchema}} +{{#unless noExtends}}out {{/unless}} Map src/main/kotlin/packagename/components/schemas/types/schema_input_type }}>? + {{~else}} +{{#unless noExtends}}out {{/unless}} Map? + {{~/with}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! none of the types are null }} + {{#and (contains types "integer") (contains types "number") }} +Number + {{~else}} +Any + {{~/and}} + {{/contains}} + {{else}} + {{! 3 or more types }} + {{#contains types "null"}} +Any? + {{~else}} +Any + {{~/contains}} + {{/eq}} + {{/eq}} +{{else}} +Any? +{{~/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs new file mode 100644 index 00000000000..abad648e88d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base.hbs @@ -0,0 +1,154 @@ +{{#if types}} + {{#eq types.size 1}} + {{#each types}} + {{#eq this "boolean"}} +Boolean + {{~else}} + {{#eq this "null"}} +Nothing? + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +String + {{~else}} +String + {{~/eq}} + {{else}} + {{#eq this "number"}} +Number + {{~else}} + {{#eq this "integer"}} +Number + {{~else}} + {{#eq this "array"}} + {{#if arrayOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{arrayOutputJsonPathPiece.pascalCase}}](#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}} + {{~else}} +{{arrayOutputJsonPathPiece.pascalCase}} + {{~/if}} + {{/if}} + {{else}} +FrozenList<{{#if noAnnotations}}*{{else}}Any?{{/if}}> + {{~/if}} + {{else}} + {{#eq this "object"}} + {{#if mapOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{mapOutputJsonPathPiece.pascalCase}}](#{{mapOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}} + {{~else}} +{{mapOutputJsonPathPiece.pascalCase}} + {{~/if}} + {{/if}} + {{~else}} +FrozenMap<{{#if noAnnotations}}*{{else}}Any?{{/if}}> + {{~/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{#eq types.size 2}} + {{#contains types "null"}} + {{! nullable types }} + {{#each types}} + {{#eq this "boolean"}} +Boolean? + {{~else}} + {{#eq this "string"}} + {{#eq format "binary"}} +{{! todo binary types}} +String? + {{~else}} +String? + {{~/eq}} + {{else}} + {{#eq this "number"}} +Number? + {{~else}} + {{#eq this "integer"}} +Number? + {{~else}} + {{#eq this "array"}} + {{#if arrayOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{arrayOutputJsonPathPiece.pascalCase}}](#{{arrayOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{fullRefModule}}.{{arrayOutputJsonPathPiece.pascalCase}}? + {{~else}} +{{arrayOutputJsonPathPiece.pascalCase}}? + {{~/if}} + {{/if}} + {{else}} +FrozenList<{{#if noAnnotations}}*{{else}}Any?{{/if}}>? + {{~/if}} + {{else}} + {{#eq this "object"}} + {{#if mapOutputJsonPathPiece}} + {{#if useLink}} + {{#if fullRefModule}} +[{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) + {{~else}} +[{{mapOutputJsonPathPiece.pascalCase}}](#{{mapOutputJsonPathPiece.kebabCase}}) + {{~/if}} + {{else}} + {{#if fullRefModule}} +{{fullRefModule}}.{{mapOutputJsonPathPiece.pascalCase}}? + {{~else}} +{{mapOutputJsonPathPiece.pascalCase}}? + {{~/if}} + {{/if}} + {{~else}} +FrozenMap<{{#if noAnnotations}}*{{else}}Any?{{/if}}>? + {{~/if}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/each}} + {{else}} + {{! none of the types are null }} + {{#and (contains types "integer") (contains types "number") }} +Number + {{~else}} +Any + {{~/and}} + {{/contains}} + {{else}} + {{! 3 or more types }} + {{#contains types "null"}} +Any? + {{~else}} +Any + {{~/contains}} + {{/eq}} + {{/eq}} +{{else}} +Any? +{{~/if}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_input_type.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_input_type.hbs new file mode 100644 index 00000000000..51d9057c81f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_input_type.hbs @@ -0,0 +1,13 @@ +{{#if refInfo}} + {{#if refInfo.refModule}} + {{#with getDeepestRef}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base }} + {{/with}} + {{else}} + {{#with refInfo.ref}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base }} + {{/with}} + {{/if}} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_input_type_base }} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_output_type.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_output_type.hbs new file mode 100644 index 00000000000..f26ad98b913 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/types/schema_output_type.hbs @@ -0,0 +1,13 @@ +{{#if refInfo}} + {{#if refInfo.refModule}} + {{#with getDeepestRef}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base fullRefModule=containerJsonPathPiece.pascalCase }} + {{/with}} + {{else}} + {{#with refInfo.ref}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base }} + {{/with}} + {{/if}} +{{else}} +{{> src/main/kotlin/packagename/components/schemas/types/_schema_output_type_base }} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs new file mode 100644 index 00000000000..82a83e75a4c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample.hbs @@ -0,0 +1,73 @@ + {{#each typeToExample}} + +{{#eq @key "null"}} +{{../jsonPathPiece.pascalCase}}BoxedVoid {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( +{{else}} + {{#eq @key "object"}} + {{#if ../mapOutputJsonPathPiece}} +{{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = + {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedMap {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/if}} + {{else}} + {{#eq @key "array"}} + {{#if ../arrayOutputJsonPathPiece}} +{{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = + {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedList {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/if}} + {{else}} + {{#eq @key "string" }} +{{../jsonPathPiece.pascalCase}}BoxedString {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq @key "integer"}} + {{#or (eq ../format null) (eq ../format "int64") }} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/or}} + {{else}} + {{#eq @key "number"}} + {{#eq ../format "int64"}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq ../format "float"}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} + {{#eq ../format "double"}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{else}} +{{../jsonPathPiece.pascalCase}}BoxedNumber {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq @key "boolean"}} +{{../jsonPathPiece.pascalCase}}BoxedBoolean {{../payloadVarName}} = {{../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validateAndBox( + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} + {{#with this}} + {{#and (eq type "array") ../arrayInputJsonPathPiece.pascalCase }} + new {{../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true }} + .build(), + {{else}} + {{#and (eq type "object") ../mapInputJsonPathPiece.pascalCase }} + new {{../containerJsonPathPiece.pascalCase}}.{{../mapInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true optionalProperties=../optionalProperties requiredProperties=../requiredProperties }} + .build(), + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/and}} + {{/and}} + {{/with}} + {{../configVarName}} +); + {{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs new file mode 100644 index 00000000000..7189cb85491 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample.hbs @@ -0,0 +1,86 @@ + {{#each typeToExample}} + +{{#eq @key "null"}} +// null validation +Nothing? {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( +{{else}} + {{#eq @key "object"}} + {{#if ../mapOutputJsonPathPiece}} +// Map validation +{{../../../containerJsonPathPiece.pascalCase}}.{{../mapOutputJsonPathPiece.pascalCase}} {{../payloadVarName}} = + {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// Map validation +FrozenMap {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/if}} + {{else}} + {{#eq @key "array"}} + {{#if ../arrayOutputJsonPathPiece}} +// List validation +{{../../../containerJsonPathPiece.pascalCase}}.{{../arrayOutputJsonPathPiece.pascalCase}} {{../payloadVarName}} = + {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// List validation +FrozenList {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/if}} + {{else}} + {{#eq @key "string" }} +// String validation +String {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} + {{#eq @key "integer"}} + {{#or (eq ../format null) (eq ../format "int64") }} +// long validation +long {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// int validation +int {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/or}} + {{else}} + {{#eq @key "number"}} + {{#eq ../format "int64"}} +// long validation +long {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} + {{#eq ../format "float"}} +// float validation +float {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} + {{#eq ../format "double"}} +// double validation +double {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{else}} +// int validation +int {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq @key "boolean"}} +// boolean validation +boolean {{../payloadVarName}} = {{../../../containerJsonPathPiece.pascalCase}}.{{../jsonPathPiece.pascalCase}}.validate( + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} + {{#with this}} + {{#and (eq type "array") ../arrayInputJsonPathPiece.pascalCase }} + new {{../../../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true }} + .build(), + {{else}} + {{#and (eq type "object") ../mapInputJsonPathPiece.pascalCase }} + new {{../../../containerJsonPathPiece.pascalCase}}.{{../mapInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="" constructor=true optionalProperties=../optionalProperties requiredProperties=../requiredProperties }} + .build(), + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/and}} + {{/and}} + {{/with}} + {{../configVarName}} +); + {{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs new file mode 100644 index 00000000000..2e1175d980c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme.hbs @@ -0,0 +1,138 @@ +package {{packageName}}.components.securityschemes; + +{{#with securityScheme}} + {{#if refInfo}} + {{! todo handle this}} +// todo handle refed security schemes + + {{else}} + {{#eq type "apiKey"}} + {{#eq in "cookie"}} +import {{packageName}}.securityschemes.ApiKeyCookieSecurityScheme; + {{else}} + {{#eq in "header"}} +import {{packageName}}.securityschemes.ApiKeyHeaderSecurityScheme; + {{else}} + {{#eq in "query"}} +import {{packageName}}.securityschemes.ApiKeyQuerySecurityScheme; + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "http"}} + {{#eq scheme "basic"}} +import {{packageName}}.securityschemes.HttpBasicSecurityScheme; + {{else}} + {{#eq scheme "bearer"}} +import {{packageName}}.securityschemes.HttpBearerSecurityScheme; + {{else}} + {{#eq scheme "signature"}} +import {{packageName}}.securityschemes.HttpSignatureSecurityScheme; + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "mutualTLS"}} +import {{packageName}}.securityschemes.MutualTlsSecurityScheme; + {{else}} + {{#eq type "oauth2"}} +import {{packageName}}.securityschemes.OAuth2SecurityScheme; + {{else}} + {{#eq type "openIdConnect"}} +import {{packageName}}.securityschemes.OpenIdConnectSecurityScheme; + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + + {{#eq type "apiKey"}} + {{#eq in "cookie"}} +public class {{jsonPathPiece.pascalCase}} extends ApiKeyCookieSecurityScheme { + {{else}} + {{#eq in "header"}} +public class {{jsonPathPiece.pascalCase}} extends ApiKeyHeaderSecurityScheme { + {{else}} + {{#eq in "query"}} +public class {{jsonPathPiece.pascalCase}} extends ApiKeyQuerySecurityScheme { + {{/eq}} + {{/eq}} + {{/eq}} + {{#if description}} + /* + {{description.original}} + */ + {{/if}} + {{#eq in "cookie"}} + public {{jsonPathPiece.pascalCase}}(String apiKey) { + super(apiKey, "{{{name}}}"); + } + {{else}} + {{#eq in "header"}} + public {{jsonPathPiece.pascalCase}}(String apiKey) { + super(apiKey, "{{{name}}}"); + } + {{else}} + {{#eq in "query"}} + public {{jsonPathPiece.pascalCase}}(String apiKey) { + super(apiKey, "{{{name}}}"); + } + {{/eq}} + {{/eq}} + {{/eq}} +} + {{else}} + {{#eq type "http"}} +public class {{jsonPathPiece.pascalCase}} extends Http{{#eq scheme "basic"}}Basic{{/eq}}{{#eq scheme "bearer"}}Bearer{{/eq}}{{#eq scheme "signature"}}Signature{{/eq}}{{#eq scheme "digest"}}Digest{{/eq}}SecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} + {{#eq scheme "basic"}} + public {{jsonPathPiece.pascalCase}}(String userId, String password) { + super(userId, password); + } + {{else}} + {{#eq scheme "bearer"}} + public {{jsonPathPiece.pascalCase}}(String accessToken) { + super(accessToken, "{{{bearerFormat}}}"); + } + {{/eq}} + {{/eq}} +} + {{else}} + {{#eq type "mutualTLS"}} +public class {{jsonPathPiece.pascalCase}} extends MutualTlsSecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} +} + {{else}} + {{#eq type "oauth2"}} +public class {{jsonPathPiece.pascalCase}} extends OAuth2SecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} + // todo add flows info +} + {{else}} + {{#eq type "openIdConnect"}} +public class {{jsonPathPiece.pascalCase}} extends OpenIdConnectSecurityScheme { + {{#if description}} + /* + {{description.original}} + */ + {{/if}} +} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/if}} +{{/with}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs new file mode 100644 index 00000000000..cdd2f4444e0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/SecurityScheme_doc.hbs @@ -0,0 +1,122 @@ +{{#with securityScheme}} + {{#if componentModule}} +{{packageName}}.components.securityschemes.{{jsonPathPiece.snakeCase}} + {{/if}} + {{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces "SecurityScheme" jsonPathPiece) }} + {{/eq}} + {{#if refInfo}} +| Ref Class | Description | +| --------- | ----------- | +| [{{refInfo.refClass}}](../../components/security_schemes/{{refInfo.refModule}}.{{refInfo.refClass}}.md#) |{{#with getDeepestRef}}{{#if description}} {{description.originalWithBr}}{{/if}}{{/with}} + {{else}} + +public class {{jsonPathPiece.pascalCase}} + {{#eq type "apiKey"}} + {{#eq in "cookie"}} +extends ApiKeyCookieSecurityScheme + {{else}} + {{#eq in "header"}} +extends ApiKeyHeaderSecurityScheme + {{else}} + {{#eq in "query"}} +extends ApiKeyQuerySecurityScheme + {{/eq}} + {{/eq}} + {{/eq}} + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#eq in "query"}} +| {{jsonPathPiece.pascalCase}}(String apiKey)
for query apiKey auth | + {{else}} + {{#eq in "header"}} +| {{jsonPathPiece.pascalCase}}(String apiKey)
for header apiKey auth | + {{else}} + {{#eq in "cookie"}} +| {{jsonPathPiece.pascalCase}}(String apiKey)
for cookie apiKey auth | + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "http"}} + {{#eq scheme "basic"}} +extends HttpBasicSecurityScheme + {{else}} + {{#eq scheme "bearer"}} +extends HttpBearerSecurityScheme + {{else}} + {{#eq scheme "digest"}} +extends HttpDigestSecurityScheme + {{else}} + {{#eq scheme "signature"}} +extends HttpSignatureSecurityScheme + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#eq scheme "basic"}} +| {{jsonPathPiece.pascalCase}}(String userId, String password) | + {{else}} + {{#eq scheme "bearer"}} +| {{jsonPathPiece.pascalCase}}(String accessToken) | + {{else}} + {{#eq scheme "digest"}} +| todo | + {{else}} + {{#eq scheme "signature"}} +| todo | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{else}} + {{#eq type "mutualTLS"}} +extends MutualTlsSecurityScheme + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + {{else}} + {{#eq type "oauth2"}} +extends Oauth2SecurityScheme + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + {{else}} + {{#eq type "openIdConnect"}} +extends OpenIdConnectSecurityScheme + +{{> src/main/kotlin/packagename/components/securityschemes/_doc_descMethods }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| todo | + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{/eq}} + {{#if componentModule}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" securitySchemesLink=true}} + {{/if}} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/_doc_descMethods.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/_doc_descMethods.hbs new file mode 100644 index 00000000000..1c8e6fdae62 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/components/securityschemes/_doc_descMethods.hbs @@ -0,0 +1,11 @@ +A class that is used to apply auth to a request +{{#if description}} + +{{headerSize}}## Description +{{description.originalWithBr}} +{{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| void | applyAuth(Map> headers, String resourcePath, String method, HttpRequest.BodyPublisher bodyPublisher, @Nullable String queryParamsSuffix, List scopeNames) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/ApiConfiguration.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/ApiConfiguration.hbs new file mode 100644 index 00000000000..251dfb5e375 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/ApiConfiguration.hbs @@ -0,0 +1,243 @@ +package {{{packageName}}}.configurations; + +{{#gt allSecurity.size 0}} +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObject; +{{/gt}} +import {{{packageName}}}.servers.Server; +{{#each allServers}} + {{#if subpackage}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} +{{/each}} +{{#each allSecurity}} + {{#if subpackage}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} +{{/each}} +{{#if securitySchemes}} +import {{packageName}}.securityschemes.SecurityScheme; +{{/if}} +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.HashMap; + +public class ApiConfiguration { + private final ServerInfo serverInfo; + private final ServerIndexInfo serverIndexInfo; + {{#gt allSecurity.size 0}} + private final SecurityInfo securityInfo; + private final SecurityIndexInfo securityIndexInfo; + {{/gt}} + private final @Nullable Duration timeout; + {{#if securitySchemes}} + private final Map, SecurityScheme> securitySchemeInfo; + {{/if}} + private final Map> defaultHeaders; + + public ApiConfiguration() { + serverInfo = new ServerInfoBuilder().build(); + serverIndexInfo = new ServerIndexInfoBuilder().build(); + {{#gt allSecurity.size 0}} + securityInfo = new SecurityInfo(); + securityIndexInfo = new SecurityIndexInfoBuilder().build(); + {{/gt}} + {{#if securitySchemes}} + securitySchemeInfo = new HashMap<>(); + {{/if}} + timeout = null; + defaultHeaders = new HashMap<>(); + } + + public ApiConfiguration(ServerInfo serverInfo, ServerIndexInfo serverIndexInfo{{#if securitySchemes}}, List securitySchemes{{/if}}{{#gt allSecurity.size 0}}, SecurityIndexInfo securityIndexInfo{{/gt}}, Duration timeout, Map> defaultHeaders) { + this.serverInfo = serverInfo; + this.serverIndexInfo = serverIndexInfo; + {{#gt allSecurity.size 0}} + this.securityInfo = new SecurityInfo(); + this.securityIndexInfo = securityIndexInfo; + {{/gt}} + {{#if securitySchemes}} + securitySchemeInfo = new HashMap<>(); + for (SecurityScheme securityScheme: securitySchemes) { + securitySchemeInfo.put(securityScheme.getClass(), securityScheme); + } + {{/if}} + this.timeout = timeout; + this.defaultHeaders = defaultHeaders; + } + + public static class ServerInfo { + {{#each allServers}} + final {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}; + {{/each}} + + ServerInfo( + {{#each allServers}} + {{jsonPathPiece.pascalCase}}. @Nullable {{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}{{#unless @last}},{{/unless}} + {{/each}} + ) { + {{#each allServers}} + this.{{jsonPathPiece.camelCase}} = Objects.requireNonNullElse({{jsonPathPiece.camelCase}}, new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}Builder().build()); + {{/each}} + } + } + + public static class ServerInfoBuilder { + {{#each allServers}} + private {{jsonPathPiece.pascalCase}}. @Nullable {{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}; + {{/each}} + public ServerInfoBuilder() {} + {{#each allServers}} + + public ServerInfoBuilder {{jsonPathPiece.camelCase}}({{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}) { + this.{{jsonPathPiece.camelCase}} = {{jsonPathPiece.camelCase}}; + return this; + } + {{/each}} + + public ServerInfo build() { + return new ServerInfo( + {{#each allServers}} + {{jsonPathPiece.camelCase}}{{#unless @last}},{{/unless}} + {{/each}} + ); + } + } + + public static class ServerIndexInfo { + {{#each allServers}} + final {{jsonPathPiece.pascalCase}}.ServerIndex {{jsonPathPiece.camelCase}}ServerIndex; + {{/each}} + + ServerIndexInfo( + {{#each allServers}} + {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex {{jsonPathPiece.camelCase}}ServerIndex{{#unless @last}},{{/unless}} + {{/each}} + ) { + {{#each allServers}} + this.{{jsonPathPiece.camelCase}}ServerIndex = Objects.requireNonNullElse({{jsonPathPiece.camelCase}}ServerIndex, {{jsonPathPiece.pascalCase}}.ServerIndex.SERVER_0); + {{/each}} + } + } + + public static class ServerIndexInfoBuilder { + {{#each allServers}} + private {{jsonPathPiece.pascalCase}}. @Nullable ServerIndex {{jsonPathPiece.camelCase}}ServerIndex; + {{/each}} + public ServerIndexInfoBuilder() {} + {{#each allServers}} + + public ServerIndexInfoBuilder {{jsonPathPiece.camelCase}}ServerIndex({{jsonPathPiece.pascalCase}}.ServerIndex serverIndex) { + this.{{jsonPathPiece.camelCase}}ServerIndex = serverIndex; + return this; + } + {{/each}} + + public ServerIndexInfo build() { + return new ServerIndexInfo( + {{#each allServers}} + {{jsonPathPiece.camelCase}}ServerIndex{{#unless @last}},{{/unless}} + {{/each}} + ); + } + } + {{#each allServers}} + + public Server getServer({{jsonPathPiece.pascalCase}}. @Nullable ServerIndex serverIndex) { + var serverProvider = serverInfo.{{jsonPathPiece.camelCase}}; + if (serverIndex == null) { + {{jsonPathPiece.pascalCase}}.ServerIndex configServerIndex = serverIndexInfo.{{jsonPathPiece.camelCase}}ServerIndex; + return serverProvider.getServer(configServerIndex); + } + return serverProvider.getServer(serverIndex); + } + {{/each}} + {{#gt allSecurity.size 0}} + + public static class SecurityInfo { + {{#each allSecurity}} + protected final {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 {{jsonPathPiece.camelCase}}; + {{/each}} + + public SecurityInfo() { + {{#each allSecurity}} + this.{{jsonPathPiece.camelCase}} = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(); + {{/each}} + } + } + + public static class SecurityIndexInfo { + {{#each allSecurity}} + final {{jsonPathPiece.pascalCase}}.SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex; + {{/each}} + + SecurityIndexInfo( + {{#each allSecurity}} + {{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex{{#unless @last}},{{/unless}} + {{/each}} + ) { + {{#each allSecurity}} + this.{{jsonPathPiece.camelCase}}SecurityIndex = Objects.requireNonNullElse({{jsonPathPiece.camelCase}}SecurityIndex, {{jsonPathPiece.pascalCase}}.SecurityIndex.SECURITY_0); + {{/each}} + } + } + + public static class SecurityIndexInfoBuilder { + {{#each allSecurity}} + private {{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex {{jsonPathPiece.camelCase}}SecurityIndex; + {{/each}} + public SecurityIndexInfoBuilder() {} + {{#each allSecurity}} + + public SecurityIndexInfoBuilder {{jsonPathPiece.camelCase}}SecurityIndex({{jsonPathPiece.pascalCase}}.SecurityIndex securityIndex) { + this.{{jsonPathPiece.camelCase}}SecurityIndex = securityIndex; + return this; + } + {{/each}} + + public SecurityIndexInfo build() { + return new SecurityIndexInfo( + {{#each allSecurity}} + {{jsonPathPiece.camelCase}}SecurityIndex{{#unless @last}},{{/unless}} + {{/each}} + ); + } + } + + {{#each allSecurity}} + public SecurityRequirementObject getSecurityRequirementObject({{jsonPathPiece.pascalCase}}. @Nullable SecurityIndex securityIndex) { + var securityInfoInstance = securityInfo.{{jsonPathPiece.camelCase}}; + if (securityIndex == null) { + {{jsonPathPiece.pascalCase}}.SecurityIndex configSecurityIndex = securityIndexInfo.{{jsonPathPiece.camelCase}}SecurityIndex; + return securityInfoInstance.getSecurityRequirementObject(configSecurityIndex); + } + return securityInfoInstance.getSecurityRequirementObject(securityIndex); + } + {{/each}} + {{/gt}} + {{#if securitySchemes}} + + public SecurityScheme getSecurityScheme(Class securitySchemeClass) { + @Nullable SecurityScheme securityScheme = securitySchemeInfo.get(securitySchemeClass); + if (securityScheme == null) { + throw new RuntimeException("SecurityScheme of class " + securitySchemeClass + "cannot be returned because it is unset. Pass in an instance of it in securitySchemes when instantiating ApiConfiguration."); + } + return securityScheme; + } + {{/if}} + + public Map> getDefaultHeaders() { + return defaultHeaders; + } + + public @Nullable Duration getTimeout() { + return timeout; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs new file mode 100644 index 00000000000..271621b8ffa --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/JsonSchemaKeywordFlags.hbs @@ -0,0 +1,446 @@ +package {{{packageName}}}.configurations; + +data class JsonSchemaKeywordFlags( + val additionalProperties: Boolean, + val allOf: Boolean, + val anyOf: Boolean, + val const_: Boolean, + val contains: Boolean, + val dependentRequired: Boolean, + val dependentSchemas: Boolean, + val discriminator: Boolean, + val else_: Boolean, + val enum_: Boolean, + val exclusiveMaximum: Boolean, + val exclusiveMinimum: Boolean, + val format: Boolean, + val if_: Boolean, + val maximum: Boolean, + val minimum: Boolean, + val items: Boolean, + val maxContains: Boolean, + val maxItems: Boolean, + val maxLength: Boolean, + val maxProperties: Boolean, + val minContains: Boolean, + val minItems: Boolean, + val minLength: Boolean, + val minProperties: Boolean, + val multipleOf: Boolean, + val not: Boolean, + val oneOf: Boolean, + val pattern: Boolean, + val patternProperties: Boolean, + val prefixItems: Boolean, + val properties: Boolean, + val propertyNames: Boolean, + val required: Boolean, + val then: Boolean, + val type: Boolean, + val uniqueItems: Boolean, + val unevaluatedItems: Boolean, + val unevaluatedProperties: Boolean +) { + val keywords: LinkedHashSet + get() { + val enabledKeywords = LinkedHashSet() + if (additionalProperties) { + enabledKeywords.add("additionalProperties") + } + if (allOf) { + enabledKeywords.add("allOf") + } + if (anyOf) { + enabledKeywords.add("anyOf") + } + if (const_) { + enabledKeywords.add("const") + } + if (contains) { + enabledKeywords.add("contains") + } + if (dependentRequired) { + enabledKeywords.add("dependentRequired") + } + if (dependentSchemas) { + enabledKeywords.add("dependentSchemas") + } + if (discriminator) { + enabledKeywords.add("discriminator") + } + if (else_) { + enabledKeywords.add("else_") + } + if (enum_) { + enabledKeywords.add("enum_") + } + if (exclusiveMaximum) { + enabledKeywords.add("exclusiveMaximum") + } + if (exclusiveMinimum) { + enabledKeywords.add("exclusiveMinimum") + } + if (format) { + enabledKeywords.add("format") + } + if (if_) { + enabledKeywords.add("if_") + } + if (maximum) { + enabledKeywords.add("maximum") + } + if (minimum) { + enabledKeywords.add("minimum") + } + if (items) { + enabledKeywords.add("items") + } + if (maxContains) { + enabledKeywords.add("maxContains") + } + if (maxItems) { + enabledKeywords.add("maxItems") + } + if (maxLength) { + enabledKeywords.add("maxLength") + } + if (maxProperties) { + enabledKeywords.add("maxProperties") + } + if (minContains) { + enabledKeywords.add("minContains") + } + if (minItems) { + enabledKeywords.add("minItems") + } + if (minLength) { + enabledKeywords.add("minLength") + } + if (minProperties) { + enabledKeywords.add("minProperties") + } + if (multipleOf) { + enabledKeywords.add("multipleOf") + } + if (not) { + enabledKeywords.add("not") + } + if (oneOf) { + enabledKeywords.add("oneOf") + } + if (pattern) { + enabledKeywords.add("pattern") + } + if (patternProperties) { + enabledKeywords.add("patternProperties") + } + if (prefixItems) { + enabledKeywords.add("prefixItems") + } + if (properties) { + enabledKeywords.add("properties") + } + if (propertyNames) { + enabledKeywords.add("propertyNames") + } + if (required) { + enabledKeywords.add("required") + } + if (then) { + enabledKeywords.add("then") + } + if (type) { + enabledKeywords.add("type") + } + if (uniqueItems) { + enabledKeywords.add("uniqueItems") + } + if (unevaluatedItems) { + enabledKeywords.add("unevaluatedItems") + } + if (unevaluatedProperties) { + enabledKeywords.add("unevaluatedProperties") + } + return enabledKeywords + } + + class Builder { + private var additionalProperties = false + private var allOf = false + private var anyOf = false + private var const_ = false + private var contains = false + private var dependentRequired = false + private var dependentSchemas = false + private var discriminator = false + private var else_ = false + private var enum_ = false + private var exclusiveMaximum = false + private var exclusiveMinimum = false + private var format = false + private var if_ = false + private var maximum = false + private var minimum = false + private var items = false + private var maxContains = false + private var maxItems = false + private var maxLength = false + private var maxProperties = false + private var minContains = false + private var minItems = false + private var minLength = false + private var minProperties = false + private var multipleOf = false + private var not = false + private var oneOf = false + private var pattern = false + private var patternProperties = false + private var prefixItems = false + private var properties = false + private var propertyNames = false + private var required = false + private var then = false + private var type = false + private var uniqueItems = false + private var unevaluatedItems = false + private var unevaluatedProperties = false + fun additionalProperties(): Builder { + additionalProperties = true + return this + } + + fun allOf(): Builder { + allOf = true + return this + } + + fun anyOf(): Builder { + anyOf = true + return this + } + + fun const_(): Builder { + const_ = true + return this + } + + fun contains(): Builder { + contains = true + return this + } + + fun dependentRequired(): Builder { + dependentRequired = true + return this + } + + fun dependentSchemas(): Builder { + dependentSchemas = true + return this + } + + fun discriminator(): Builder { + discriminator = true + return this + } + + fun else_(): Builder { + else_ = true + return this + } + + fun enum_(): Builder { + enum_ = true + return this + } + + fun exclusiveMaximum(): Builder { + exclusiveMaximum = true + return this + } + + fun exclusiveMinimum(): Builder { + exclusiveMinimum = true + return this + } + + fun format(): Builder { + format = true + return this + } + + fun if_(): Builder { + if_ = true + return this + } + + fun maximum(): Builder { + maximum = true + return this + } + + fun minimum(): Builder { + minimum = true + return this + } + + fun items(): Builder { + items = true + return this + } + + fun maxContains(): Builder { + maxContains = true + return this + } + + fun maxItems(): Builder { + maxItems = true + return this + } + + fun maxLength(): Builder { + maxLength = true + return this + } + + fun maxProperties(): Builder { + maxProperties = true + return this + } + + fun minContains(): Builder { + minContains = true + return this + } + + fun minItems(): Builder { + minItems = true + return this + } + + fun minLength(): Builder { + minLength = true + return this + } + + fun minProperties(): Builder { + minProperties = true + return this + } + + fun multipleOf(): Builder { + multipleOf = true + return this + } + + operator fun not(): Builder { + not = true + return this + } + + fun oneOf(): Builder { + oneOf = true + return this + } + + fun pattern(): Builder { + pattern = true + return this + } + + fun patternProperties(): Builder { + patternProperties = true + return this + } + + fun prefixItems(): Builder { + prefixItems = true + return this + } + + fun properties(): Builder { + properties = true + return this + } + + fun propertyNames(): Builder { + propertyNames = true + return this + } + + fun required(): Builder { + required = true + return this + } + + fun then(): Builder { + then = true + return this + } + + fun type(): Builder { + type = true + return this + } + + fun uniqueItems(): Builder { + uniqueItems = true + return this + } + + fun unevaluatedItems(): Builder { + unevaluatedItems = true + return this + } + + fun unevaluatedProperties(): Builder { + unevaluatedProperties = true + return this + } + + fun build(): JsonSchemaKeywordFlags { + return JsonSchemaKeywordFlags( + additionalProperties, + allOf, + anyOf, + const_, + contains, + dependentRequired, + dependentSchemas, + discriminator, + else_, + enum_, + exclusiveMaximum, + exclusiveMinimum, + format, + if_, + maximum, + minimum, + items, + maxContains, + maxItems, + maxLength, + maxProperties, + minContains, + minItems, + minLength, + minProperties, + multipleOf, + not, + oneOf, + pattern, + patternProperties, + prefixItems, + properties, + propertyNames, + required, + then, + type, + uniqueItems, + unevaluatedItems, + unevaluatedProperties + ) + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs new file mode 100644 index 00000000000..fd0ce0991d3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/configurations/SchemaConfiguration.hbs @@ -0,0 +1,3 @@ +package {{{packageName}}}.configurations; + +data class SchemaConfiguration(val disabledKeywordFlags: JsonSchemaKeywordFlags) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs new file mode 100644 index 00000000000..e5b81809466 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDeserializer.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.contenttype; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ContentTypeDeserializer { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + + @SuppressWarnings("nullness") + public static @Nullable Object fromJson(String json) { + return gson.fromJson(json, Object.class); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs new file mode 100644 index 00000000000..a3ff25132bd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeDetector.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.contenttype; + +import java.util.regex.Pattern; + +public class ContentTypeDetector { + private static final Pattern jsonContentTypePattern = Pattern.compile( + "application/[^+]*[+]?(json);?.*" + ); + private static final String textPlainContentType = "text/plain"; + + public static boolean contentTypeIsJson(String contentType) { + return jsonContentTypePattern.matcher(contentType).find(); + } + + public static boolean contentTypeIsTextPlain(String contentType) { + return textPlainContentType.equals(contentType); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs new file mode 100644 index 00000000000..0302192e32e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/contenttype/ContentTypeSerializer.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.contenttype; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; + +public class ContentTypeSerializer { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + + @SuppressWarnings("nullness") + public static String toJson(@Nullable Object body) { + return gson.toJson(body); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs new file mode 100644 index 00000000000..538e79d633f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ApiException.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.exceptions; + +import java.net.http.HttpResponse; + +class ApiException(s: String?, val response: HttpResponse) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs new file mode 100644 index 00000000000..51528cde504 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/BaseException.hbs @@ -0,0 +1,3 @@ +package {{{packageName}}}.exceptions; + +open class BaseException(s: String?) : Exception(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs new file mode 100644 index 00000000000..cd5e66a6f46 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/InvalidAdditionalPropertyException.hbs @@ -0,0 +1,3 @@ +package {{{packageName}}}.exceptions; + +class InvalidAdditionalPropertyException(s: String?) : BaseException(s) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs new file mode 100644 index 00000000000..4b09819638e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/NotImplementedException.hbs @@ -0,0 +1,3 @@ +package {{{packageName}}}.exceptions; + +class NotImplementedException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs new file mode 100644 index 00000000000..2eac3a273e9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/UnsetPropertyException.hbs @@ -0,0 +1,3 @@ +package {{{packageName}}}.exceptions; + +class UnsetPropertyException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs new file mode 100644 index 00000000000..595dca21426 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/exceptions/ValidationException.hbs @@ -0,0 +1,3 @@ +package {{{packageName}}}.exceptions; + +class ValidationException(s: String?) : BaseException(s) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/ContentHeader.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/ContentHeader.hbs new file mode 100644 index 00000000000..83631bb6e09 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/ContentHeader.hbs @@ -0,0 +1,59 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeSerializer; +import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.mediatype.MediaType; +import {{{packageName}}}.parameter.ParameterStyle; + +import java.net.http.HttpHeaders; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; +import java.util.function.BiPredicate; + +public class ContentHeader extends HeaderBase implements Header { + public final AbstractMap.SimpleEntry> content; + + public ContentHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, AbstractMap.SimpleEntry> content) { + super(required, ParameterStyle.SIMPLE, explode, allowReserved); + this.content = content; + } + + private static HttpHeaders toHeaders(String name, String value) { + Map> map = Map.of(name, List.of(value)); + BiPredicate headerFilter = (key, val) -> true; + return HttpHeaders.of(map, headerFilter); + } + + @Override + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + var castInData = validate ? content.getValue().schema().validate(inData, configuration) : inData ; + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(castInData); + return toHeaders(name, value); + } else { + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); + } + } + + @Override + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + String inDataJoined = String.join(",", inData); // unsure if this is needed + @Nullable Object deserializedJson = ContentTypeDeserializer.fromJson(inDataJoined); + if (validate) { + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + return content.getValue().schema().validate(deserializedJson, configuration); + } else { + throw new NotImplementedException("Header deserialization of "+contentType+" has not yet been implemented"); + } + } + return deserializedJson; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/Header.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Header.hbs new file mode 100644 index 00000000000..f9bbeae3a7a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Header.hbs @@ -0,0 +1,14 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; + +import java.net.http.HttpHeaders; +import java.util.List; + +public interface Header { + HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException; + @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/HeaderBase.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/HeaderBase.hbs new file mode 100644 index 00000000000..5cceec00321 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/HeaderBase.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.parameter.ParameterStyle; + +public class HeaderBase { + public final boolean required; + public final @Nullable ParameterStyle style; + public final @Nullable Boolean explode; + public final @Nullable Boolean allowReserved; + + public HeaderBase(boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { + this.required = required; + this.style = style; + this.explode = explode; + this.allowReserved = allowReserved; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs new file mode 100644 index 00000000000..a1c542e9408 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/PrefixSeparatorIterator.hbs @@ -0,0 +1,27 @@ +package {{{packageName}}}.header; + +import java.util.Set; + +public class PrefixSeparatorIterator { + // A class to store prefixes and separators for rfc6570 expansions + public final String prefix; + public final String separator; + private boolean first; + public final String itemSeparator; + private static final Set reusedSeparators = Set.of(".", "|", "%20"); + + public PrefixSeparatorIterator(String prefix, String separator) { + this.prefix = prefix; + this.separator = separator; + itemSeparator = reusedSeparators.contains(separator) ? separator : ","; + first = true; + } + + public String next() { + if (first) { + first = false; + return prefix; + } + return separator; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/Rfc6570Serializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Rfc6570Serializer.hbs new file mode 100644 index 00000000000..d17e18e5c43 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/Rfc6570Serializer.hbs @@ -0,0 +1,197 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class Rfc6570Serializer { + private static final String ENCODING = "UTF-8"; + private static final Set namedParameterSeparators = Set.of("&", ";"); + + private static String percentEncode(String s) throws NotImplementedException { + if (s == null) { + return ""; + } + try { + return URLEncoder.encode(s, ENCODING) + // OAuth encodes some characters differently: + .replace("+", "%20").replace("*", "%2A") + .replace("%7E", "~"); + // This could be done faster with more hand-crafted code. + } catch (UnsupportedEncodingException wow) { + @Nullable String msg = wow.getMessage(); + if (msg == null) { + throw new NotImplementedException("UnsupportedEncodingException thrown"); + } + throw new NotImplementedException(msg); + } + } + + private static @Nullable String rfc6570ItemValue(@Nullable Object item, boolean percentEncode) throws NotImplementedException { + /* + Get representation if str/float/int/None/items in list/ values in dict + None is returned if an item is undefined, use cases are value= + - None + - [] + - {} + - [None, None None] + - {'a': None, 'b': None} + */ + if (item instanceof String stringItem) { + if (percentEncode) { + return percentEncode(stringItem); + } + return stringItem; + } else if (item instanceof Number numberItem) { + return numberItem.toString(); + } else if (item == null) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } else if (item instanceof List && ((List) item).isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } else if (item instanceof Map && ((Map) item).isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return null; + } + throw new NotImplementedException("Unable to generate a rfc6570 item representation of "+item); + } + + private static String rfc6570StrNumberExpansion( + @Nullable Object inData, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + var itemValue = rfc6570ItemValue(inData, percentEncode); + if (itemValue == null || (itemValue.isEmpty() && prefixSeparatorIterator.separator.equals(";"))) { + return prefixSeparatorIterator.next() + varNamePiece; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + return prefixSeparatorIterator.next() + varNamePiece + valuePairEquals + itemValue; + } + + private static String rfc6570ListExpansion( + List inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + List itemValues = new ArrayList<>(); + for (Object v: inData) { + @Nullable String value = rfc6570ItemValue(v, percentEncode); + if (value == null) { + continue; + } + itemValues.add(value); + } + if (itemValues.isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + if (!explode) { + return ( + prefixSeparatorIterator.next() + + varNamePiece + + valuePairEquals + + String.join(prefixSeparatorIterator.itemSeparator, itemValues) + ); + } + // exploded + return prefixSeparatorIterator.next() + itemValues.stream().map(v -> varNamePiece + valuePairEquals + v).collect(Collectors.joining(prefixSeparatorIterator.next())); + } + + private static String rfc6570MapExpansion( + Map inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator, + String varNamePiece, + boolean namedParameterExpansion + ) throws NotImplementedException { + Map inDataMap = new LinkedHashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + @Nullable String value = rfc6570ItemValue(entry.getValue(), percentEncode); + if (value == null) { + continue; + } + @Nullable Object key = entry.getKey(); + if (!(key instanceof String strKey)) { + continue; + } + inDataMap.put(strKey, value); + } + if (inDataMap.isEmpty()) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } + var valuePairEquals = namedParameterExpansion ? "=" : ""; + if (!explode) { + return prefixSeparatorIterator.next() + + varNamePiece + + valuePairEquals + + inDataMap.entrySet().stream().map(e -> e.getKey()+prefixSeparatorIterator.itemSeparator+e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.itemSeparator)); + } + // exploded + return prefixSeparatorIterator.next() + inDataMap.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(prefixSeparatorIterator.next())); + } + + protected static String rfc6570Expansion( + String variableName, + @Nullable Object inData, + boolean explode, + boolean percentEncode, + PrefixSeparatorIterator prefixSeparatorIterator + ) throws NotImplementedException { + /* + Separator is for separate variables like dict with explode true, + not for array item separation + */ + var namedParameterExpansion = namedParameterSeparators.contains(prefixSeparatorIterator.separator); + var varNamePiece = namedParameterExpansion ? variableName : ""; + if (inData instanceof Number || inData instanceof String) { + return rfc6570StrNumberExpansion( + inData, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } else if (inData == null) { + // ignored by the expansion process https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.1 + return ""; + } else if (inData instanceof List listData) { + return rfc6570ListExpansion( + listData, + explode, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } else if (inData instanceof Map mapData) { + return rfc6570MapExpansion( + mapData, + explode, + percentEncode, + prefixSeparatorIterator, + varNamePiece, + namedParameterExpansion + ); + } + // bool, bytes, etc + throw new NotImplementedException("Unable to generate a rfc6570 representation of "+inData); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/SchemaHeader.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/SchemaHeader.hbs new file mode 100644 index 00000000000..1544ff1d21c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/SchemaHeader.hbs @@ -0,0 +1,97 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.parameter.ParameterStyle; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchemaFactory; +import {{{packageName}}}.schemas.validation.UnsetAnyTypeJsonSchema; + +import java.net.http.HttpHeaders; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiPredicate; + +public class SchemaHeader extends HeaderBase implements Header { + public final JsonSchema schema; + + public SchemaHeader(boolean required, @Nullable Boolean allowReserved, @Nullable Boolean explode, JsonSchema schema) { + super(required, ParameterStyle.SIMPLE, explode, allowReserved); + this.schema = schema; + } + + private static HttpHeaders toHeaders(String name, String value) { + Map> map = Map.of(name, List.of(value)); + BiPredicate headerFilter = (key, val) -> true; + return HttpHeaders.of(map, headerFilter); + } + + @Override + public HttpHeaders serialize(@Nullable Object inData, String name, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + var castInData = validate ? schema.validate(inData, configuration) : inData; + boolean usedExplode = explode != null && explode; + var value = StyleSerializer.serializeSimple(castInData, name, usedExplode, false); + return toHeaders(name, value); + } + + private static final Set> VOID_TYPES = Set.of(Nothing?.class); + private static final Set> BOOLEAN_TYPES = Set.of(Boolean.class); + private static final Set> NUMERIC_TYPES = Set.of( + Integer.class, + Long.class, + Float.class, + Double.class + ); + private static final Set> STRING_TYPES = Set.of(String.class); + private static final Set> LIST_TYPES = Set.of(List.class); + private static final Set> MAP_TYPES = Set.of(Map.class); + + private List<@Nullable Object> getList(JsonSchema schema, List inData) throws NotImplementedException { + Class> itemsSchemaCls = schema.items == null ? UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.class : schema.items; + JsonSchema itemSchema = JsonSchemaFactory.getInstance(itemsSchemaCls); + List<@Nullable Object> castList = new ArrayList<>(); + for (String inDataItem: inData) { + @Nullable Object castInDataItem = getCastInData(itemSchema, List.of(inDataItem)); + castList.add(castInDataItem); + } + return castList; + } + + private @Nullable Object getCastInData(JsonSchema schema, List inData) throws NotImplementedException { + if (schema.type == null) { + if (inData.size() == 1) { + return inData.get(0); + } + return getList(schema, inData); + } else if (schema.type.size() == 1) { + if (schema.type.equals(BOOLEAN_TYPES)) { + throw new NotImplementedException("Boolean serialization is not defined in Rfc6570, there is no agreed upon way to sent a boolean, send a string enum instead"); + } else if (schema.type.equals(VOID_TYPES) && inData.size() == 1 && inData.get(0).isEmpty()) { + return null; + } else if (schema.type.equals(STRING_TYPES) && inData.size() == 1) { + return inData.get(0); + } else if (schema.type.equals(LIST_TYPES)) { + return getList(schema, inData); + } else if (schema.type.equals(MAP_TYPES)) { + throw new NotImplementedException("Header map deserialization has not yet been implemented"); + } + } else if (schema.type.size() == 4 && schema.type.equals(NUMERIC_TYPES) && inData.size() == 1) { + return ContentTypeDeserializer.fromJson(inData.get(0)); + } + throw new NotImplementedException("Header deserialization for schemas with multiple types has not yet been implemented"); + } + + @Override + public @Nullable Object deserialize(List inData, boolean validate, SchemaConfiguration configuration) throws NotImplementedException, ValidationException { + @Nullable Object castInData = getCastInData(schema, inData); + if (validate) { + return schema.validate(castInData, configuration); + } + return castInData; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/header/StyleSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/header/StyleSerializer.hbs new file mode 100644 index 00000000000..9efe3ff849e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/header/StyleSerializer.hbs @@ -0,0 +1,99 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +public class StyleSerializer extends Rfc6570Serializer { + public static String serializeSimple( + @Nullable Object inData, + String name, + boolean explode, + boolean percentEncode + ) throws NotImplementedException { + var prefixSeparatorIterator = new PrefixSeparatorIterator("", ","); + return rfc6570Expansion( + name, + inData, + explode, + percentEncode, + prefixSeparatorIterator + ); + } + + public static String serializeForm( + @Nullable Object inData, + String name, + boolean explode, + boolean percentEncode + ) throws NotImplementedException { + // todo check that the prefix and suffix matches this one + PrefixSeparatorIterator iterator = new PrefixSeparatorIterator("", "&"); + return rfc6570Expansion( + name, + inData, + explode, + percentEncode, + iterator + ); + } + + public static String serializeMatrix( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(";", ";"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializeLabel( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator(".", "."); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializeSpaceDelimited( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "%20"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } + + public static String serializePipeDelimited( + @Nullable Object inData, + String name, + boolean explode + ) throws NotImplementedException { + PrefixSeparatorIterator usedIterator = new PrefixSeparatorIterator("", "|"); + return rfc6570Expansion( + name, + inData, + explode, + true, + usedIterator + ); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/Encoding.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/Encoding.hbs new file mode 100644 index 00000000000..5d6d9d6ec49 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/Encoding.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.mediatype; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.parameter.ParameterStyle; +import {{{packageName}}}.header.Header; + +import java.util.Map; + +public class Encoding { + public final String contentType; + public final @Nullable Map headers; + public final @Nullable ParameterStyle style; + public final boolean explode; + public final boolean allowReserved; + + public Encoding(String contentType) { + this.contentType = contentType; + headers = null; + style = null; + explode = false; + allowReserved = false; + } + public Encoding(String contentType, @Nullable Map headers) { + this.contentType = contentType; + this.headers = headers; + style = null; + explode = false; + allowReserved = false; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/MediaType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/MediaType.hbs new file mode 100644 index 00000000000..d4afc4449dd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/mediatype/MediaType.hbs @@ -0,0 +1,16 @@ +package {{{packageName}}}.mediatype; + +import {{{packageName}}}.schemas.validation.JsonSchema; + +public interface MediaType, U> { + /* + * Used to store request and response body schema information + * encoding: + * A map between a property name and its encoding information. + * The key, being the property name, MUST exist in the schema as a property. + * The encoding object SHALL only apply to requestBody objects when the media type is + * multipart or application/x-www-form-urlencoded. + */ + T schema(); + U encoding(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ContentParameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ContentParameter.hbs new file mode 100644 index 00000000000..ba1ab60208d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ContentParameter.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeSerializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.mediatype.MediaType; + +import java.util.Map; +import java.util.AbstractMap; + +public class ContentParameter extends ParameterBase implements Parameter { + public final AbstractMap.SimpleEntry> content; + + public ContentParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, AbstractMap.SimpleEntry> content) { + super(name, inType, required, style, explode, allowReserved); + this.content = content; + } + + @Override + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + String contentType = content.getKey(); + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + var value = ContentTypeSerializer.toJson(inData); + return new AbstractMap.SimpleEntry<>(name, value); + } else { + throw new NotImplementedException("Serialization of "+contentType+" has not yet been implemented"); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/CookieSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/CookieSerializer.hbs new file mode 100644 index 00000000000..5905efe7ed3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/CookieSerializer.hbs @@ -0,0 +1,36 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.Map; +import java.util.TreeMap; + +public abstract class CookieSerializer { + private final Map parameters; + + protected CookieSerializer(Map parameters) { + this.parameters = parameters; + } + + public String serialize(Map inData) throws NotImplementedException { + String result = ""; + Map sortedData = new TreeMap<>(inData); + for (Map.Entry entry: sortedData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + if (result.isEmpty()) { + result = serialized.getValue(); + } else { + result = result + "; " + serialized.getValue(); + } + } + return result; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/HeadersSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/HeadersSerializer.hbs new file mode 100644 index 00000000000..d2f10e695ef --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/HeadersSerializer.hbs @@ -0,0 +1,32 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; + +public abstract class HeadersSerializer { + private final Map parameters; + + protected HeadersSerializer(Map parameters) { + this.parameters = parameters; + } + + public Map> serialize(Map inData) throws NotImplementedException { + Map> results = new LinkedHashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + results.put(serialized.getKey(), List.of(serialized.getValue())); + } + return results; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/Parameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/Parameter.hbs new file mode 100644 index 00000000000..3d2e8abeb95 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/Parameter.hbs @@ -0,0 +1,10 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; + +public interface Parameter { + AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterBase.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterBase.hbs new file mode 100644 index 00000000000..65f1feafa18 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterBase.hbs @@ -0,0 +1,15 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.header.HeaderBase; + +public class ParameterBase extends HeaderBase { + public final String name; + public final ParameterInType inType; + + public ParameterBase(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved) { + super(required, style, explode, allowReserved); + this.name = name; + this.inType = inType; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterInType.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterInType.hbs new file mode 100644 index 00000000000..3b4e45cbfb7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterInType.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.parameter; + +public enum ParameterInType { + QUERY, + HEADER, + PATH, + COOKIE +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterStyle.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterStyle.hbs new file mode 100644 index 00000000000..76671286ced --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/ParameterStyle.hbs @@ -0,0 +1,11 @@ +package {{{packageName}}}.parameter; + +public enum ParameterStyle { + MATRIX, + LABEL, + FORM, + SIMPLE, + SPACE_DELIMITED, + PIPE_DELIMITED, + DEEP_OBJECT +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/PathSerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/PathSerializer.hbs new file mode 100644 index 00000000000..82a778a630f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/PathSerializer.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.Map; + +public abstract class PathSerializer { + private final Map parameters; + + protected PathSerializer(Map parameters) { + this.parameters = parameters; + } + + public String serialize(Map inData, String pathWithPlaceholders) throws NotImplementedException { + String result = pathWithPlaceholders; + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + result = result.replace("{" + mapKey + "}", serialized.getValue()); + } + return result; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/QuerySerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/QuerySerializer.hbs new file mode 100644 index 00000000000..da5fecd666f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/QuerySerializer.hbs @@ -0,0 +1,48 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +public abstract class QuerySerializer { + private final Map parameters; + + protected QuerySerializer(Map parameters) { + this.parameters = parameters; + } + + public Map getQueryMap(Map inData) throws NotImplementedException { + Map results = new HashMap<>(); + for (Map.Entry entry: inData.entrySet()) { + String mapKey = entry.getKey(); + @Nullable Parameter parameter = parameters.get(mapKey); + if (parameter == null) { + throw new RuntimeException("Invalid state, a parameter must exist for every key"); + } + @Nullable Object value = entry.getValue(); + AbstractMap.SimpleEntry serialized = parameter.serialize(value); + results.put(serialized.getKey(), serialized.getValue()); + } + return new TreeMap<>(results); + } + + public String serialize(Map queryMap) { + if (queryMap.isEmpty()) { + return ""; + } + String result = "?"; + for (String serializedValue: queryMap.values()) { + if (result.length() == 1) { + result = result + serializedValue; + } else { + result = result + "&" + serializedValue; + } + } + // TODO what if the style is not FORM? + return result; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/SchemaParameter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/SchemaParameter.hbs new file mode 100644 index 00000000000..23327283938 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/parameter/SchemaParameter.hbs @@ -0,0 +1,60 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.header.StyleSerializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.validation.JsonSchema; + +import java.util.AbstractMap; + +public class SchemaParameter extends ParameterBase implements Parameter { + public final JsonSchema schema; + + public SchemaParameter(String name, ParameterInType inType, boolean required, @Nullable ParameterStyle style, @Nullable Boolean explode, @Nullable Boolean allowReserved, JsonSchema schema) { + super(name, inType, required, style, explode, allowReserved); + this.schema = schema; + } + + private ParameterStyle getStyle() { + if (style != null) { + return style; + } + if (inType == ParameterInType.QUERY || inType == ParameterInType.COOKIE) { + return ParameterStyle.FORM; + } + // ParameterInType.HEADER || ParameterInType.PATH + return ParameterStyle.SIMPLE; + } + + @Override + public AbstractMap.SimpleEntry serialize(@Nullable Object inData) throws NotImplementedException { + ParameterStyle usedStyle = getStyle(); + boolean percentEncode = inType == ParameterInType.QUERY || inType == ParameterInType.PATH; + String value; + boolean usedExplode = explode == null ? usedStyle == ParameterStyle.FORM : explode; + if (usedStyle == ParameterStyle.SIMPLE) { + // header OR path + value = StyleSerializer.serializeSimple(inData, name, usedExplode, percentEncode); + } else if (usedStyle == ParameterStyle.FORM) { + // query OR cookie + value = StyleSerializer.serializeForm(inData, name, usedExplode, percentEncode); + } else if (usedStyle == ParameterStyle.LABEL) { + // path + value = StyleSerializer.serializeLabel(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.MATRIX) { + // path + value = StyleSerializer.serializeMatrix(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.SPACE_DELIMITED) { + // query + value = StyleSerializer.serializeSpaceDelimited(inData, name, usedExplode); + } else if (usedStyle == ParameterStyle.PIPE_DELIMITED) { + // query + value = StyleSerializer.serializePipeDelimited(inData, name, usedExplode); + } else { + // usedStyle == ParameterStyle.DEEP_OBJECT + // query + throw new NotImplementedException("Style deep object serialization has not yet been implemented."); + } + return new AbstractMap.SimpleEntry<>(name, value); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/PathItem.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/PathItem.hbs new file mode 100644 index 00000000000..cc2ccab03b3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/PathItem.hbs @@ -0,0 +1,7 @@ +{{#with pathItem}} +package {{packageName}}.{{subpackage}}; + +public class {{jsonPathPiece.pascalCase}} { + public static final String path = "{{{jsonPathPiece.original}}}"; +} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Operation.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Operation.hbs new file mode 100644 index 00000000000..07e3ec110aa --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Operation.hbs @@ -0,0 +1,391 @@ +{{#with operation}} +package {{packageName}}.{{subpackage}}; + +import org.checkerframework.checker.nullness.qual.Nullable; + {{#each builders}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +import {{packageName}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{else}} + {{#if this.jsonPathPiece}} + {{#if subpackage}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + {{#with parametersInfo}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} + {{#with responses}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} +import {{packageName}}.apiclient.ApiClient; +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.exceptions.ApiException; +import {{packageName}}.restclient.RestClient; + {{#if requestBody}} +import {{packageName}}.requestbody.SerializedRequestBody; + {{/if}} + {{#with ../pathItem}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} +import {{packageName}}.securityrequirementobjects.SecurityRequirementObject; +import {{packageName}}.securityrequirementobjects.AuthApplier; + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + +import java.io.IOException; + {{#if requestBody}} +import java.util.ArrayList; + {{/if}} +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class {{jsonPathPiece.pascalCase}} { + private static class {{method.pascalCase}}Provider{{#each builders}}{{#if @first}}{{#each keyToBuilder}}{{#eq @key.camelCase "securityIndex"}} extends AuthApplier{{/eq}}{{/each}}{{/if}}{{/each}} { + private static final String method = "{{jsonPathPiece.original}}"; + + public static {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Nothing?{{/if}} {{method.camelCase}}( + {{method.pascalCase}}Request request, + ApiConfiguration apiConfiguration, + SchemaConfiguration schemaConfiguration, + HttpClient client + ) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + Map> headers = apiConfiguration.getDefaultHeaders(); + {{#with requestBody}} + + {{#if getSelfOrDeepestRef.required }} + SerializedRequestBody serializedRequestBody = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + HttpRequest.BodyPublisher bodyPublisher = serializedRequestBody.bodyPublisher; + {{else}} + @Nullable SerializedRequestBody serializedRequestBody; + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + if (request.requestBody != null) { + serializedRequestBody = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1().serialize( + request.requestBody + ); + var contentTypeHeaderValues = headers.getOrDefault("Content-Type", new ArrayList<>()); + contentTypeHeaderValues.add(serializedRequestBody.contentType); + bodyPublisher = serializedRequestBody.bodyPublisher; + } + {{/if}} + {{else}} + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.noBody(); + {{/with}} + {{#with parametersInfo}} + {{#if headerParametersSchema}} + + {{#if headerParametersSchema.requiredProperties}} + var headersSerializer = new {{jsonPathPiece.pascalCase}}.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + {{else}} + if (request.headerParameters != null) { + var headersSerializer = new {{jsonPathPiece.pascalCase}}.HeaderParametersSerializer(); + Map> serializedHeaders = headersSerializer.serialize(request.headerParameters); + headers.putAll(serializedHeaders); + } + {{/if}} + {{/if}} + {{#if cookieParametersSchema}} + + {{#if cookieParametersSchema.requiredProperties}} + var cookieSerializer = new {{jsonPathPiece.pascalCase}}.CookieParametersSerializer(); + String serializedCookie = cookieSerializer.serialize(request.cookieParameters); + var cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + cookieHeaderValues.add(serializedCookie); + {{else}} + if (request.cookieParameters != null) { + var cookieSerializer = new {{jsonPathPiece.pascalCase}}.CookieParametersSerializer(); + String serializedCookie = cookieSerializer.serialize(request.cookieParameters); + var cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + cookieHeaderValues.add(serializedCookie); + } + {{/if}} + {{/if}} + {{#if pathParametersSchema}} + + {{! path parameters are always required }} + var pathSerializer = new {{jsonPathPiece.pascalCase}}.PathParametersSerializer(); + String updatedPath = pathSerializer.serialize(request.pathParameters, {{#with ../pathItem}}{{jsonPathPiece.pascalCase}}.{{/with}}path); + {{/if}} + {{#if queryParametersSchema}} + + {{#if queryParametersSchema.requiredProperties}} + var querySerializer = new {{jsonPathPiece.pascalCase}}.QueryParametersSerializer(); + @Nullable Map queryMap = querySerializer.getQueryMap(request.queryParameters); + {{else}} + var querySerializer = new {{jsonPathPiece.pascalCase}}.QueryParametersSerializer(); + @Nullable Map queryMap = null; + if (request.queryParameters != null) { + queryMap = querySerializer.getQueryMap(request.queryParameters); + } + {{/if}} + {{else}} + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + {{/if}} + {{else}} + // TODO set this to a map if there is a query security scheme + @Nullable Map queryMap = null; + {{/with}} + String host = apiConfiguration.getServer(request.serverIndex).url(); + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + SecurityRequirementObject securityRequirementObject = apiConfiguration.getSecurityRequirementObject(request.securityIndex); + updateParamsForAuth( + securityRequirementObject, + headers, + {{#and parametersInfo parametersInfo.pathParametersSchema}}updatedPath{{else}}{{#with ../pathItem}}{{jsonPathPiece.pascalCase}}.{{/with}}path{{/and}}, + method, + bodyPublisher, + queryMap, + apiConfiguration + ); + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + + String url = host + {{#and parametersInfo parametersInfo.pathParametersSchema}}updatedPath{{else}}{{#with ../pathItem}}{{jsonPathPiece.pascalCase}}.{{/with}}path{{/and}}; + {{#if queryParametersSchema }} + if (queryMap != null) { + url = url + querySerializer.serialize(queryMap); + } + {{/if}} + var httpRequest = RestClient.getRequest( + url, + method, + bodyPublisher, + headers, + request.timeout + ); + var response = RestClient.getResponse(httpRequest, client); + {{#if nonErrorResponses }} + var responsesDeserializer = new {{#with responses}}{{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1{{/with}}(); + return responsesDeserializer.deserialize(response, schemaConfiguration); + {{else}} + return (Nothing?) null; + {{/if}} + } + } + + public interface {{method.pascalCase}}Operation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Nothing?{{/if}} {{jsonPathPiece.camelCase}}({{method.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return {{method.pascalCase}}Provider.{{method.camelCase}}(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + {{#neq method.pascalCase operationId.pascalCase}} + + public interface {{operationId.pascalCase}}Operation { + ApiConfiguration getApiConfiguration(); + SchemaConfiguration getSchemaConfiguration(); + HttpClient getClient(); + default {{#if nonErrorResponses }}{{#with responses}}{{jsonPathPiece.pascalCase}}.EndpointResponse{{/with}}{{else}}Nothing?{{/if}} {{operationId.camelCase}}({{method.pascalCase}}Request request) throws IOException, InterruptedException, ValidationException, NotImplementedException, ApiException { + return {{method.pascalCase}}Provider.{{jsonPathPiece.camelCase}}(request, getApiConfiguration(), getSchemaConfiguration(), getClient()); + } + } + {{/neq}} + + public static class {{method.pascalCase}} extends ApiClient implements {{method.pascalCase}}Operation { + public {{method.pascalCase}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration) { + super(apiConfiguration, schemaConfiguration); + } + } + {{#eq builders.size 1}} + + public static class {{method.pascalCase}}Request { + {{#each builders}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + public {{containerJsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + {{#if this.jsonPathPiece}} + public {{jsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + public @Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/each}} + } + {{else}} + + public static class {{method.pascalCase}}Request { + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + public {{containerJsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + {{#if this.jsonPathPiece}} + public {{jsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + public {{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + + public {{method.pascalCase}}Request( + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + {{containerJsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}{{#and ../../@last ../@last}}{{else}},{{/and}} + {{else}} + {{#if this.jsonPathPiece}} + {{jsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}{{#and ../../@last ../@last}}{{else}},{{/and}} + {{else}} + {{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} {{@key.camelCase}}{{#and ../../@last ../@last}}{{else}},{{/and}} + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + ) { + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + this.{{@key.camelCase}} = {{@key.camelCase}}; + {{/each}} + {{/or}} + {{/each}} + } + } + + public static class {{method.pascalCase}}NullableRequest { + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + public {{containerJsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + {{#if this.jsonPathPiece}} + public {{jsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{else}} + public @Nullable {{operationInputClassName.pascalCase}} {{@key.camelCase}}; + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + } + {{/eq}} + {{#each builders}} + {{#or @first @last}} + {{#each keyToBuilder}} + + public interface SetterFor{{@key.pascalCase}} { + {{../../method.pascalCase}}{{#gt ../../builders.size 1}}Nullable{{/gt}}Request getInstance(); + T getBuilderAfter{{@key.pascalCase}}({{../../method.pascalCase}}{{#gt ../../builders.size 1}}Nullable{{/gt}}Request instance); + default T {{@key.camelCase}}({{#with property}}{{#if containerJsonPathPiece}}{{containerJsonPathPiece.pascalCase}}.{{else}}{{#if this.jsonPathPiece}}{{jsonPathPiece.pascalCase}}.{{/if}}{{/if}}{{operationInputClassName.pascalCase}}{{/with}} {{@key.camelCase}}) { + var instance = getInstance(); + instance.{{@key.camelCase}} = {{@key.camelCase}}; + return getBuilderAfter{{@key.pascalCase}}(instance); + } + } + {{/each}} + {{/or}} + {{/each}} + + {{#each builders}} + public static class {{className.pascalCase}}{{#if keyToBuilder}} implements {{/if}}{{#each keyToBuilder}}SetterFor{{@key.pascalCase}}<{{builder.className.pascalCase}}>{{#unless @last}}, {{/unless}}{{/each}} { + private final {{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request instance; + + {{#if @last }} + public {{className.pascalCase}}() { + this.instance = new {{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request(); + } + {{else}} + public {{className.pascalCase}}({{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request instance) { + this.instance = instance; + } + {{/if}} + {{#if @first}} + + public {{../method.pascalCase}}Request build() { + {{#gt ../builders.size 1}} + {{#each builders}} + {{#if @last}} + {{#each keyToBuilder}} + var {{@key.camelCase}} = instance.{{@key.camelCase}}; + if ({{@key.camelCase}} == null) { + throw new RuntimeException("invalid null value for required parameter"); + } + {{/each}} + {{/if}} + {{/each}} + return new {{../method.pascalCase}}Request( + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#if ../@last}}instance.{{/if}}{{@key.camelCase}}{{#and ../@last @last}}{{else}},{{/and}} + {{/each}} + {{/or}} + {{/each}} + ); + {{else}} + return instance; + {{/gt}} + } + {{/if}} + {{#if keyToBuilder}} + + public {{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request getInstance() { + return instance; + } + {{/if}} + {{#each keyToBuilder}} + + public {{builder.className.pascalCase}} getBuilderAfter{{@key.pascalCase}}({{../method.pascalCase}}{{#gt ../builders.size 1}}Nullable{{/gt}}Request instance) { + {{#eq builder ../this}} + {{! property in final builder }} + return this; + {{else}} + return new {{builder.className.pascalCase}}(instance); + {{/eq}} + } + {{/each}} + } + {{/each}} +} +{{/with}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs new file mode 100644 index 00000000000..7eabec0b446 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/OperationDoc.hbs @@ -0,0 +1,118 @@ +{{#with operation}} +{{headerSize}} {{jsonPathPiece.pascalCase}} + +public class {{jsonPathPiece.pascalCase}} + +A class that contains necessary endpoint classes +- a class that calls the endpoint method using the http verb +- a class that calls the endpoint method using the operationId name +- class(es) to store the request inputs +- builder(s) to set the request input data + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{method.pascalCase}}](#{{method.kebabCase}})
The class that has a {{method.camelCase}} method to call the endpoint | +{{#neq method.pascalCase operationId.pascalCase}} +| interface | [{{operationId.pascalCase}}Operation](#{{operationId.kebabCase}}operation)
The interface that has a {{operationId.camelCase}} method to call the endpoint | +{{/neq}} + {{#eq builders.size 1}} +| static class | [{{method.pascalCase}}Request](#{{method.kebabCase}}request)
The request inputs class | + {{else}} +| static class | [{{method.pascalCase}}Request](#{{method.kebabCase}}request)
The final request inputs class | +| static class | [{{method.pascalCase}}NullableRequest](#{{method.kebabCase}}nullablerequest)
The initial request inputs class | + {{/eq}} + {{#each builders}} +| static class | [{{className.pascalCase}}](#{{className.kebabCase}})
A builder for the request input class | + {{/each}} + +{{headerSize}}# {{method.pascalCase}} +public static class {{method.pascalCase}} extends ApiClient.ApiClient1 implements {{method.pascalCase}}Operation
+ +a class that allows one to call the endpoint using a method named {{method.camelCase}} + +{{headerSize}}## Code Sample +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample apiSubpackage=subpackage apiContainerClass=jsonPathPiece.pascalCase apiFullyQualifiedClass=(join jsonPathPiece.pascalCase method.pascalCase ".") }} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{method.pascalCase}}(ApiConfiguration apiConfiguration, SchemaConfiguration schemaConfiguration)
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | {{method.camelCase}}([{{method.pascalCase}}Request](#{{method.kebabCase}}request) request) | +{{#neq method.pascalCase operationId.pascalCase}} + +{{headerSize}}# {{operationId.pascalCase}}Operation +public interface {{operationId.pascalCase}}Operation
+ +an interface that allows one to call the endpoint using a method named {{operationId.camelCase}} by the operationId + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| {{#if nonErrorResponses }}{{#with responses}}[{{jsonPathPiece.pascalCase}}.EndpointResponse]({{docRoot}}{{pathFromDocRoot}}.md#endpointresponse){{/with}}{{else}}Nothing?{{/if}} | {{operationId.camelCase}}([{{method.pascalCase}}Request](#{{method.kebabCase}}request) request) | +{{/neq}} + + {{#eq builders.size 1}} +{{> src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc }} + {{else}} +{{> src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc }} + +{{headerSize}}# {{method.pascalCase}}NullableRequest +public static class {{method.pascalCase}}NullableRequest
+ +a class that stores the initial request inputs + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | + {{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +| [{{containerJsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}} | + {{else}} + {{#if this.jsonPathPiece}} +| [{{jsonPathPiece.pascalCase}}.@Nullable {{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}} | + {{else}} +| @Nullable {{operationInputClassName.pascalCase}} | {{@key.camelCase}} | + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + {{/eq}} + {{#each builders}} + +{{headerSize}}# {{className.pascalCase}} +public static class {{className.pascalCase}}
+ +a builder for request inputs + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | + {{#if @last }} +| {{className.pascalCase}}()
Creates a builder that contains null for all parameters | + {{else}} +| {{className.pascalCase}}({{className.pascalCase}} instance)
Creates a builder that contains the passed instance | + {{/if}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | + {{#if @first}} +| [{{method.pascalCase}}Request](#{{method.kebabCase}}request) | build()
Returns the request input used to call an endpoint method | + {{/if}} + {{#each keyToBuilder}} +| [{{builder.className.pascalCase}}](#{{builder.className.kebabCase}}) | {{@key.camelCase}}({{#with property}}{{#if containerJsonPathPiece}}[{{containerJsonPathPiece.pascalCase}}{{else}}{{#if this.jsonPathPiece}}[{{jsonPathPiece.pascalCase}}.{{/if}}{{/if}}{{operationInputClassName.pascalCase}}{{#or containerJsonPathPiece this.jsonPathPiece}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}){{/or}}{{/with}} {{@key.camelCase}})
sets the {{#if ../@first}}optional {{/if}}property{{#or (eq @key.camelCase "securityIndex") (eq @key.camelCase "serverIndex") (eq @key.camelCase "timeout")}}. Note: this will override the value in apiConfiguration{{/or}} | + {{/each}} + {{/each}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" endpointLink=true}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Parameters.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Parameters.hbs new file mode 100644 index 00000000000..d5b8af5e853 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Parameters.hbs @@ -0,0 +1,88 @@ +{{#with parametersInfo}} +package {{packageName}}.{{subpackage}}; + + {{#with pathItemParameters}} + {{#each allParameters}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/each}} + {{/with}} + {{#with parameters}} + {{#each allParameters}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/each}} + {{/with}} + {{#if pathParametersSchema}} +import {{packageName}}.parameter.PathSerializer; + {{/if}} + {{#if headerParametersSchema}} +import {{packageName}}.parameter.HeadersSerializer; + {{/if}} + {{#if queryParametersSchema}} +import {{packageName}}.parameter.QuerySerializer; + {{/if}} + {{#if cookieParametersSchema}} +import {{packageName}}.parameter.CookieSerializer; + {{/if}} + +import java.util.Map; +import java.util.AbstractMap; + +public class {{jsonPathPiece.pascalCase}} { + {{#if pathParametersSchema}} + + public static class PathParametersSerializer extends PathSerializer { + public PathParametersSerializer() { + super( + Map.ofEntries( + {{#each pathParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} + {{#if queryParametersSchema}} + + public static class QueryParametersSerializer extends QuerySerializer { + public QueryParametersSerializer() { + super( + Map.ofEntries( + {{#each queryParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} + {{#if headerParametersSchema}} + + public static class HeaderParametersSerializer extends HeadersSerializer { + public HeaderParametersSerializer() { + super( + Map.ofEntries( + {{#each headerParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} + {{#if cookieParametersSchema}} + + public static class CookieParametersSerializer extends CookieSerializer { + public CookieParametersSerializer() { + super( + Map.ofEntries( + {{#each cookieParameters}} + new AbstractMap.SimpleEntry<>("{{#with getSelfOrDeepestRef}}{{{name}}}{{/with}}", new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1()){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } + } + {{/if}} +} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Responses.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Responses.hbs new file mode 100644 index 00000000000..2aff218307e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/Responses.hbs @@ -0,0 +1,156 @@ +package {{packageName}}.{{responses.subpackage}}; + +{{#each responses}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{#with getSelfOrDeepestRef}} + {{#with headersObjectSchema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/with}} +{{/each}} +import {{{packageName}}}.exceptions.ApiException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +{{#if nonErrorResponses }} +import {{{packageName}}}.response.ApiResponse; +{{/if}} +import {{{packageName}}}.response.ResponsesDeserializer; +import {{{packageName}}}.configurations.SchemaConfiguration; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpResponse; +import java.util.Map; +import java.util.AbstractMap; + +public class {{responses.jsonPathPiece.pascalCase}} { + {{#if nonErrorResponses}} + public sealed interface EndpointResponse permits {{#each nonErrorResponses}}Endpoint{{jsonPathPiece.pascalCase}}{{#unless @last}}, {{/unless}}{{/each}} {} + {{#each nonErrorResponses}} + + public record Endpoint{{jsonPathPiece.pascalCase}}( + HttpResponse response, + {{#if hasContentSchema}}{{jsonPathPiece.pascalCase}}.SealedResponseBody{{else}}Nothing?{{/if}} body, + {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}{{/with}} headers + ) implements EndpointResponse, ApiResponse<{{#if hasContentSchema}}{{jsonPathPiece.pascalCase}}.SealedResponseBody{{else}}Nothing?{{/if}}, {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}{{/with}}>{ + } + {{/each}} + {{/if}} + {{#if statusCodeResponses}} + + public sealed interface StatusCodeResponseDeserializer permits {{#each statusCodeResponses}}Status{{jsonPathPiece.pascalCase}}Deserializer{{#unless @last}}, {{/unless}}{{/each}} {} + + {{#each statusCodeResponses}} + public static final class Status{{jsonPathPiece.pascalCase}}Deserializer extends {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 implements StatusCodeResponseDeserializer { + } + {{/each}} + {{/if}} + {{#if wildcardCodeResponses}} + public sealed interface WildcardCodeResponseDeserializer permits {{#each wildcardCodeResponses}}Wildcard{{jsonPathPiece.pascalCase}}Deserializer{{#unless @last}}, {{/unless}}{{/each}} {} + + {{#each wildcardCodeResponses}} + public static final class Wildcard{{jsonPathPiece.pascalCase}}Deserializer extends {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 implements WildcardCodeResponseDeserializer { + } + {{/each}} + {{/if}} + + public static final class {{responses.jsonPathPiece.pascalCase}}1 implements ResponsesDeserializer<{{#if nonErrorResponses }}EndpointResponse{{else}}Nothing?{{/if}}> { + {{#if statusCodeResponses}} + private final Map statusCodeToResponseDeserializer; + {{/if}} + {{#if wildcardCodeResponses}} + private final Map wildcardCodeToResponseDeserializer; + {{/if}} + {{#with defaultResponse}} + private final {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1 defaultResponseDeserializer; + {{/with}} + public {{responses.jsonPathPiece.pascalCase}}1() { + {{#if statusCodeResponses }} + this.statusCodeToResponseDeserializer = Map.ofEntries( + {{#each statusCodeResponses }} + new AbstractMap.SimpleEntry<>("{{@key}}", new Status{{jsonPathPiece.pascalCase}}Deserializer()){{#unless @last}},{{/unless}} + {{/each}} + ); + {{/if}} + {{#if wildcardCodeResponses }} + this.wildcardCodeToResponseDeserializer = Map.ofEntries( + {{#each wildcardCodeResponses }} + new AbstractMap.SimpleEntry<>("{{@key}}", new Wildcard{{jsonPathPiece.snakeCase}}Deserializer()){{#unless @last}},{{/unless}} + {{/each}} + ); + {{/if}} + {{#with defaultResponse}} + this.defaultResponseDeserializer = new {{jsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}1(); + {{/with}} + } + + public {{#if nonErrorResponses }}EndpointResponse{{else}}Nothing?{{/if}} deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { +{{#eq defaultResponse null }} + String statusCode = String.valueOf(response.statusCode()); + {{#and statusCodeResponses wildcardCodeResponses }} + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer != null) { + {{> src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization }} + } + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + {{> src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization }} + {{else}} + {{#or statusCodeResponses wildcardCodeResponses }} + {{#if statusCodeResponses }} + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + {{> src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization }} + {{else}} + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer == null) { + throw new ApiException( + "Invalid response statusCode="+statusCode+" has no response defined in the openapi document", + response + ); + } + {{> src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization }} + {{/if}} + {{/or}} + {{/and}} +{{else}} + {{#and statusCodeResponses wildcardCodeResponses }} + String statusCode = String.valueOf(response.statusCode()); + {{else}} + {{#or statusCodeResponses wildcardCodeResponses }} + String statusCode = String.valueOf(response.statusCode()); + {{#if statusCodeResponses}} + @Nullable StatusCodeResponseDeserializer statusCodeDeserializer = statusCodeToResponseDeserializer.get(statusCode); + if (statusCodeDeserializer != null) { + {{> src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization }} + } + {{else}} + @Nullable WildcardCodeResponseDeserializer wildcardCodeDeserializer = wildcardCodeToResponseDeserializer.get(statusCode); + if (wildcardCodeDeserializer != null) { + {{> src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization }} + } + {{/if}} + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + {{#with defaultResponse}} + return new Endpoint{{jsonPathPiece.pascalCase}}(response, deserializedResponse.body(), deserializedResponse.headers()); + {{/with}} + {{else}} + var deserializedResponse = defaultResponseDeserializer.deserialize(response, configuration); + {{#with defaultResponse}} + return new Endpoint{{jsonPathPiece.pascalCase}}(response, deserializedResponse.body(), deserializedResponse.headers()); + {{/with}} + {{/or}} + {{/and}} +{{/eq}} + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs new file mode 100644 index 00000000000..2216d232aa7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/ResponsesDoc.hbs @@ -0,0 +1,41 @@ +{{headerSize}} {{responses.jsonPathPiece.pascalCase}} + +public class {{responses.jsonPathPiece.pascalCase}} + +A class that contains necessary responses classes + {{#if nonErrorResponses}} +- a sealed interface, EndpointResponse, that stores endpoint responses +- records for each endpoint response + {{/if}} + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +{{#if nonErrorResponses}} +| sealed interface | [EndpointResponse](#endpointresponse)
stores the endpoint responses | + {{#each nonErrorResponses}} +| record | [Endpoint{{jsonPathPiece.pascalCase}}](#endpoint{{jsonPathPiece.kebabCase}})
the response for {{jsonPathPiece.original}} | + {{/each}} +{{/if}} +{{#if nonErrorResponses}} + +{{headerSize}}# EndpointResponse +public sealed interface EndpointResponse permits
+ {{#each nonErrorResponses}} +[Endpoint{{jsonPathPiece.pascalCase}}](#endpoint{{jsonPathPiece.kebabCase}}){{#unless @last}},{{/unless}} + {{/each}} + +a sealed interface that stores endpoint responses +{{/if}} +{{#each nonErrorResponses}} + +{{headerSize}}# Endpoint{{jsonPathPiece.pascalCase}} +public record Endpoint{{jsonPathPiece.pascalCase}}( + HttpResponse response, + {{#if hasContentSchema}}[{{jsonPathPiece.pascalCase}}.SealedResponseBody]({{docRoot}}{{pathFromDocRoot}}.md#sealedresponsebody){{else}}Nothing?{{/if}} body, + {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}){{else}}Nothing?{{/with}}{{/with}} headers +) implements EndpointResponse, ApiResponse<{{#if hasContentSchema}}{{jsonPathPiece.pascalCase}}.SealedResponseBody{{else}}Nothing?{{/if}}, {{#with getSelfOrDeepestRef}}{{#with headersObjectSchema}}{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}{{else}}Nothing?{{/with}}{{/with}}>
+ +a class that stores an endpoint response +{{/each}} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc.hbs new file mode 100644 index 00000000000..e53398ccf3e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_FinalRequestClassDoc.hbs @@ -0,0 +1,25 @@ +{{headerSize}}# {{method.pascalCase}}Request +public static class {{method.pascalCase}}Request
+ +a class that stores the final request inputs + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +{{#each (reverse builders)}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +| [{{containerJsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}}{{#if ../../@last}}
optional{{/if}} | + {{else}} + {{#if this.jsonPathPiece}} +| [{{jsonPathPiece.pascalCase}}.{{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{operationInputClassName.kebabCase}}) | {{@key.camelCase}}{{#if ../../@last}}
optional{{/if}}{{#or (eq @key.camelCase "securityIndex") (eq @key.camelCase "serverIndex")}}. Note: this will override the value in apiConfiguration{{/or}} | + {{else}} +| {{#if ../../@last}}@Nullable {{/if}}{{operationInputClassName.pascalCase}} | {{@key.camelCase}}{{#if ../../@last}}
optional{{/if}}{{#eq @key.camelCase "timeout"}}. Note: this will override the value in apiConfiguration{{/eq}} | + {{/if}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} +{{/each}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample.hbs new file mode 100644 index 00000000000..99f842d6307 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -0,0 +1,270 @@ +``` +import {{packageName}}.configurations.ApiConfiguration; +import {{packageName}}.configurations.SchemaConfiguration; +import {{packageName}}.configurations.JsonSchemaKeywordFlags; +import {{packageName}}.exceptions.ValidationException; +import {{packageName}}.exceptions.NotImplementedException; +import {{packageName}}.exceptions.ApiException; +import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.schemas.validation.FrozenList; +import {{{packageName}}}.schemas.validation.FrozenMap; + {{#each builders}} + {{#or @first @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} +import {{packageName}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{else}} + {{#if this.jsonPathPiece}} + {{#if subpackage}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{else}} +import {{packageName}}.{{jsonPathPiece.pascalCase}}; + {{/if}} + {{/if}} + {{/if}} + {{#if ../../@last}} + {{#eq @key.camelCase "requestBody"}} + {{#with getSelfOrDeepestRef}} + {{#each content}} + {{#if @first}} + {{#with schema}} + {{#with getSelfOrDeepestRef}} +import {{packageName}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/with}} + {{/if}} + {{/each}} + {{/with}} + {{/eq}} + {{/if}} + {{/with}} + {{/each}} + {{/or}} + {{/each}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "serverIndex"}} + {{#with property}} + {{! CodegenList of CodegenServer }} + {{#each this}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/each}} + {{/with}} + {{/eq}} + {{#eq @key.camelCase "securityIndex"}} +import {{packageName}}.securityschemes.SecurityScheme; + {{#with property}} + {{! CodegenList of SecurityRequirementObject }} + {{#each this}} + {{#each map}} + {{#with refInfo.ref}} + {{! SecurityScheme }} +import {{packageName}}.components.securityschemes.{{jsonPathPiece.pascalCase}}; + {{/with}} + {{/each}} + {{/each}} + {{/with}} + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + {{#each responses}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{#with getSelfOrDeepestRef}} + {{#with headersObjectSchema}} +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + {{/with}} + {{/with}} + {{/each}} + {{#with servers}} +import {{packageName}}.{{#if subpackage}}{{subpackage}}{{else}}servers{{/if}}.{{jsonPathPiece.pascalCase}}; + {{/with}} +import {{packageName}}.{{apiSubpackage}}.{{apiContainerClass}}; + {{#with responses}} +import {{packageName}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; + {{/with}} + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +// if you want to use a server that is not SERVER_0 pass it in here and change the ServerIndex input below +ApiConfiguration.ServerInfo serverInfo = new ApiConfiguration.ServerInfoBuilder() + .{{servers.jsonPathPiece.camelCase}}( + new {{servers.jsonPathPiece.pascalCase}}.{{servers.jsonPathPiece.pascalCase}}Builder() + {{#each servers}} + {{#if @first}} + .{{jsonPathPiece.camelCase}}(new {{jsonPathPiece.pascalCase}}()) + .build() + {{/if}} + {{/each}} + ) + .build(); +ApiConfiguration.ServerIndexInfo serverIndexInfo = new ApiConfiguration.ServerIndexInfoBuilder() + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "serverIndex"}} + {{#with property}} + {{! CodegenList of CodegenServer }} + .{{jsonPathPiece.camelCase}}ServerIndex({{jsonPathPiece.pascalCase}}.ServerIndex.SERVER_0) + {{/with}} + {{/eq}} + {{/each}} + .build(); + {{/if}} + {{/each}} + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + {{#with property}} +List securitySchemes = new ArrayList(); + {{! CodegenList of SecurityRequirementObject }} + {{#each this}} + {{#each map}} + {{#with refInfo.ref}} +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample }} + {{/with}} + {{/each}} + {{/each}} + {{/with}} + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + {{#each security}} + {{#if @first}} +ApiConfiguration.SecurityIndexInfo securityIndexInfo = new ApiConfiguration.SecurityIndexInfoBuilder() + .{{jsonPathPiece.camelCase}}SecurityIndex({{jsonPathPiece.pascalCase}}.SecurityIndex.SECURITY_0) + .build(); + {{/if}} + {{/each}} +Duration timeout = Duration.ofSeconds(1L); +Map> defaultHeaders = Map.of("User-Agent", List.of("{{#if httpUserAgent}}{{{httpUserAgent}}}{{else}}OpenAPI-JSON-Schema-Generator/{{{artifactVersion}}}/java{{/if}}")); +ApiConfiguration apiConfiguration = new ApiConfiguration( + serverInfo + serverIndexInfo, + {{#each builders}} + {{#if @first}} + {{#each keyToBuilder}} + {{#eq @key.camelCase "securityIndex"}} + securitySchemes, + securityIndexInfo, + {{/eq}} + {{/each}} + {{/if}} + {{/each}} + timeout, + defaultHeaders +); +SchemaConfiguration schemaConfiguration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); +{{apiFullyQualifiedClass}} apiClient = new {{apiFullyQualifiedClass}}(apiConfiguration, schemaConfiguration); + + {{#gt builders.size 1}} + {{#each builders}} + {{#if @last}} + {{#each keyToBuilder}} + {{#with property}} + {{#if containerJsonPathPiece}} + {{#each (reverse getSchemas)}} + {{#eq instanceType "schema"}} +{{> src/main/kotlin/packagename/components/schemas/validateSchemaCodeSample payloadVarName=../@key.camelCase configVarName="schemaConfiguration" }} + {{/eq}} + {{/each}} + {{else}} + {{! CodegenRequestBody }} + {{#with getSelfOrDeepestRef}} + {{#each content}} + {{#if @first}} + {{#with schema}} + {{#with getSelfOrDeepestRef}} +{{> src/main/kotlin/packagename/components/schemas/validateAndBoxSchemaCodeSample payloadVarName="requestBodyPayload" configVarName="schemaConfiguration" }} + {{/with}} + {{/with}} +{{../../jsonPathPiece.pascalCase}}.{{../operationInputClassName.pascalCase}} {{../@key.camelCase}} = new {{../../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}RequestBody(requestBodyPayload); + {{/if}} + {{/each}} + {{/with}} + {{/if}} + {{/with}} + {{/each}} + {{/if}} + {{/each}} + {{/gt}} + + {{#eq builders.size 1}} + {{! only option props}} + {{#each builders}} +var request = new {{../jsonPathPiece.pascalCase}}.{{className.pascalCase}}().build(); + {{/each}} + {{else}} + {{#each builders}} + {{#if @last}} +var request = new {{../jsonPathPiece.pascalCase}}.{{className.pascalCase}}() + {{#each keyToBuilder}} + .{{@key.camelCase}}({{@key.camelCase}}) + {{#if @last}} + .build(); + {{/if}} + {{/each}} + {{/if}} + {{/each}} + {{/eq}} + +{{#if nonErrorResponses }}{{responses.jsonPathPiece.pascalCase}}.EndpointResponse{{else}}Nothing?{{/if}} response; +try { + response = apiClient.{{jsonPathPiece.camelCase}}(request); +{{#or errorStatusCodes errorWildcardStatusCodes}} +} catch ({{> src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample }} e) { + // server returned an error response defined in the openapi document + throw e; +{{/or}} +} catch (ApiException e) { + // server returned a response/contentType not defined in the openapi document + throw e; +} catch (ValidationException e) { + // the returned response body or header values do not conform the the schema validation requirements + throw e; +} catch (IOException | InterruptedException e) { + // an exception happened when making the request + throw e; +} catch (NotImplementedException e) { + // the request body serialization or deserialization has not yet been implemented + // or the header content type deserialization has not yet been implemented for this contentType + throw e; +} +{{#if nonErrorResponses}} + {{#eq nonErrorResponses.size 1}} + {{#each nonErrorResponses}} +{{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse = ({{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}}) response; + {{#if hasContentSchema}} +{{> src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} + {{/if}} + {{/each}} + {{else}} + {{#each nonErrorResponses}} + {{#if @first}} +if (response instanceof {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse) { + {{else}} + {{#if @last}} +} else { + {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse = ({{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}}) response; + {{else}} +} else if (response instanceof {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPathPiece.pascalCase}} castResponse) { + {{/if}} + {{/if}} + {{#if hasContentSchema}} + {{> src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} + {{/if}} + {{#if @last}} +} + {{/if}} + {{/each}} + {{/eq}} +{{/if}} +``` \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs new file mode 100644 index 00000000000..27e3a690131 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocExcCodeSample.hbs @@ -0,0 +1,11 @@ +{{#and errorStatusCodes errorWildcardStatusCodes}} +{{#each errorStatusCodes}}{{#with (mapLookup ../statusCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException | {{/each}}{{#each errorWildcardStatusCodes}}{{#with (mapLookup ../wildcardCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{#unless @last}} | {{/unless}}{{/each}} +{{~else}} + {{#or errorStatusCodes errorWildcardStatusCodes}} + {{#if errorStatusCodes}} +{{#each errorStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (mapLookup ../statusCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} + {{~else}} +{{#each errorWildcardStatusCodes}}{{#unless @first}} | {{/unless}}{{#with (mapLookup ../wildcardCodeResponses .)}}{{jsonPathPiece.pascalCase}}{{/with}}.ResponseApiException{{/each}} + {{~/if}} + {{/or}} +{{/and}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs new file mode 100644 index 00000000000..89c6499989c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocResBodyCodeSample.hbs @@ -0,0 +1,21 @@ +{{#eq content.size 1}} + {{#each content}} +{{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody = ({{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody) castResponse.body; +// handle deserialized body here + {{/each}} +{{else}} + {{#each content}} + {{#if @first}} +if (castResponse.body instanceof {{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody) { + {{else}} + {{#if @last}} +} else { + {{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody = ({{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody) castResponse.body; + {{else}} +} else if (castResponse.body instanceof {{../jsonPathPiece.pascalCase}}.{{@key.pascalCase}}ResponseBody deserializedBody) { + {{/if}} + {{/if}} + // handle deserialized body here + {{/each}} +} +{{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs new file mode 100644 index 00000000000..6bcbc6b1994 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_OperationDocSSCodeSample.hbs @@ -0,0 +1,20 @@ +{{! only make code samples for one that are known}} +{{#eq type "apiKey"}} +securitySchemes.add( + new {{jsonPathPiece.pascalCase}}("someApiKey"); +); +{{else}} + {{#eq type "http"}} + {{#eq scheme "basic"}} +securitySchemes.add( + new {{jsonPathPiece.pascalCase}}("someUserId", "somePassword"); +); + {{else}} + {{#eq scheme "bearer"}} +securitySchemes.add( + new {{jsonPathPiece.pascalCase}}("someAccessToken"); +); + {{/eq}} + {{/eq}} + {{/eq}} +{{/eq}} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_returnOrThrow.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_returnOrThrow.hbs new file mode 100644 index 00000000000..a78943857fe --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_returnOrThrow.hbs @@ -0,0 +1,17 @@ +{{#if nonErrorStatusCodes}} + {{#contains nonErrorStatusCodes @key }} +return new Endpoint{{jsonPathPiece.pascalCase}}(response, deserializedResponse.body(), deserializedResponse.headers()); + {{else}} +throw new {{jsonPathPiece.pascalCase}}.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse +); + {{/contains}} +{{else}} +throw new {{jsonPathPiece.pascalCase}}.ResponseApiException( + "Received error statusCode response from server", + response, + deserializedResponse +); +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization.hbs new file mode 100644 index 00000000000..54f57cf0139 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_statusCodeDeserialization.hbs @@ -0,0 +1,23 @@ +{{#eq statusCodeResponses.size 1}} + {{#each statusCodeResponses}} +Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Status{{jsonPathPiece.pascalCase}}Deserializer) statusCodeDeserializer; +var deserializedResponse = castDeserializer.deserialize(response, configuration); +{{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +{{else}} + {{#each statusCodeResponses}} + {{#if @first}} +if (statusCodeDeserializer instanceof Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{else}} + {{#if @last}} +} else { + Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Status{{jsonPathPiece.pascalCase}}Deserializer) statusCodeDeserializer; + {{else}} +} else if (statusCodeDeserializer instanceof Status{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{/if}} + {{/if}} + var deserializedResponse = castDeserializer.deserialize(response, configuration); + {{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization.hbs new file mode 100644 index 00000000000..e64169ff8b9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/paths/path/verb/_wildcardCodeDeserialization.hbs @@ -0,0 +1,23 @@ +{{#eq wildcardCodeResponses.size 1}} + {{#each wildcardCodeResponses}} +Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Wildcard{{jsonPathPiece.pascalCase}}Deserializer) wildcardCodeDeserializer; +var deserializedResponse = castDeserializer.deserialize(response, configuration); +{{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +{{else}} + {{#each wildcardCodeResponses}} + {{#if @first}} +if (wildcardCodeDeserializer instanceof Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{else}} + {{#if @last}} +} else { + Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer = (Wildcard{{jsonPathPiece.pascalCase}}Deserializer) wildcardCodeDeserializer; + {{else}} +} else if (wildcardCodeDeserializer instanceof Wildcard{{jsonPathPiece.pascalCase}}Deserializer castDeserializer) { + {{/if}} + {{/if}} + var deserializedResponse = castDeserializer.deserialize(response, configuration); + {{> src/main/kotlin/packagename/paths/path/verb/_returnOrThrow }} + {{/each}} +} +{{/eq}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs new file mode 100644 index 00000000000..a411f45b743 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/GenericRequestBody.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.requestbody; + +public interface GenericRequestBody { + String contentType(); + SealedSchemaOutputClass body(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs new file mode 100644 index 00000000000..3c1ed740dd6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/RequestBodySerializer.hbs @@ -0,0 +1,47 @@ +package {{{packageName}}}.requestbody; + +import java.net.http.HttpRequest; +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeSerializer; +import {{{packageName}}}.exceptions.NotImplementedException; + +import java.util.Map; + +public abstract class RequestBodySerializer { + /* + * Describes a single request body + * content: contentType to MediaType schema info + */ + public final Map content; + public final boolean required; + + public RequestBodySerializer(Map content, boolean required) { + this.content = content; + this.required = required; + } + + private SerializedRequestBody serializeJson(String contentType, @Nullable Object body) { + String jsonText = ContentTypeSerializer.toJson(body); + return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(jsonText)); + } + + private SerializedRequestBody serializeTextPlain(String contentType, @Nullable Object body) { + if (body instanceof String stringBody) { + return new SerializedRequestBody(contentType, HttpRequest.BodyPublishers.ofString(stringBody)); + } + throw new RuntimeException("Invalid non-string data type of "+JsonSchema.getClass(body)+" for text/plain body serialization"); + } + + protected SerializedRequestBody serialize(String contentType, @Nullable Object body) throws NotImplementedException { + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + return serializeJson(contentType, body); + } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { + return serializeTextPlain(contentType, body); + } + throw new NotImplementedException("Serialization has not yet been implemented for contentType="+contentType+". If you need it please file a PR"); + } + + public abstract SerializedRequestBody serialize(T requestBody) throws NotImplementedException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs new file mode 100644 index 00000000000..457f20ea459 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/requestbody/SerializedRequestBody.hbs @@ -0,0 +1,13 @@ +package {{{packageName}}}.requestbody; + +import java.net.http.HttpRequest; + +public class SerializedRequestBody { + public final String contentType; + public final HttpRequest.BodyPublisher bodyPublisher; + + protected SerializedRequestBody(String contentType, HttpRequest.BodyPublisher bodyPublisher) { + this.contentType = contentType; + this.bodyPublisher = bodyPublisher; + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/ApiResponse.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ApiResponse.hbs new file mode 100644 index 00000000000..00caf937855 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ApiResponse.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.response; + +import java.net.http.HttpResponse; + +public interface ApiResponse { + HttpResponse response(); + SealedBodyOutputClass body(); + HeaderOutputClass headers(); +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs new file mode 100644 index 00000000000..6c7d2077a45 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/DeserializedHttpResponse.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.response; + +import java.net.http.HttpResponse; + +public record DeserializedHttpResponse(SealedBodyOutputClass body, HeaderOutputClass headers) { +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/HeadersDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/HeadersDeserializer.hbs new file mode 100644 index 00000000000..d57437b0187 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/HeadersDeserializer.hbs @@ -0,0 +1,37 @@ +package {{{packageName}}}.response; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.header.Header; +import {{{packageName}}}.schemas.validation.MapSchemaValidator; + +import java.net.http.HttpHeaders; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public abstract class HeadersDeserializer { + private final Map headers; + final private MapSchemaValidator headersSchema; + public HeadersDeserializer(Map headers, MapSchemaValidator headersSchema) { + this.headers = headers; + this.headersSchema = headersSchema; + } + + public OutType deserialize(HttpHeaders responseHeaders, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + Map headersToValidate = new HashMap<>(); + for (Map.Entry> entry: responseHeaders.map().entrySet()) { + String headerName = entry.getKey(); + Header headerDeserializer = headers.get(headerName); + if (headerDeserializer == null) { + // todo put this data in headersToValidate, if only one item in list load it in, otherwise join them with commas + continue; + } + @Nullable Object headerValue = headerDeserializer.deserialize(entry.getValue(), false, configuration); + headersToValidate.put(headerName, headerValue); + } + return headersSchema.validate(headersToValidate, configuration); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponseDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponseDeserializer.hbs new file mode 100644 index 00000000000..05d319d1558 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponseDeserializer.hbs @@ -0,0 +1,74 @@ +package {{{packageName}}}.response; + +import java.net.http.HttpHeaders; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.Optional; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.schemas.validation.JsonSchema; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.contenttype.ContentTypeDeserializer; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ApiException; +import {{{packageName}}}.header.Header; + +public abstract class ResponseDeserializer { + public final Map content; + public final @Nullable Map headers; + + public ResponseDeserializer(Map content) { + this.content = content; + this.headers = null; + } + + protected abstract SealedBodyClass getBody(String contentType, SealedMediaTypeClass mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; + protected abstract HeaderClass getHeaders(HttpHeaders headers, SchemaConfiguration configuration) throws ValidationException, NotImplementedException; + + protected @Nullable Object deserializeJson(byte[] body) { + String bodyStr = new String(body, StandardCharsets.UTF_8); + return ContentTypeDeserializer.fromJson(bodyStr); + } + + protected String deserializeTextPlain(byte[] body) { + return new String(body, StandardCharsets.UTF_8); + } + + protected T deserializeBody(String contentType, byte[] body, JsonSchema schema, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + if (ContentTypeDetector.contentTypeIsJson(contentType)) { + @Nullable Object bodyData = deserializeJson(body); + return schema.validateAndBox(bodyData, configuration); + } else if (ContentTypeDetector.contentTypeIsTextPlain(contentType)) { + String bodyData = deserializeTextPlain(body); + return schema.validateAndBox(bodyData, configuration); + } + throw new NotImplementedException("Deserialization for contentType="+contentType+" has not yet been implemented."); + } + + public DeserializedHttpResponse deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException { + Optional contentTypeInfo = response.headers().firstValue("Content-Type"); + if (contentTypeInfo.isEmpty()) { + throw new ApiException( + "Invalid response returned, Content-Type header is missing and it must be included", + response + ); + } + String contentType = contentTypeInfo.get(); + @Nullable SealedMediaTypeClass mediaType = content.get(contentType); + if (mediaType == null) { + throw new ApiException( + "Invalid contentType returned. contentType="+contentType+" was returned "+ + "when only "+content.keySet()+" are defined for statusCode="+response.statusCode(), + response + ); + } + byte[] bodyBytes = response.body(); + SealedBodyClass body = getBody(contentType, mediaType, bodyBytes, configuration); + HeaderClass headers = getHeaders(response.headers(), configuration); + return new DeserializedHttpResponse<>(body, headers); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponsesDeserializer.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponsesDeserializer.hbs new file mode 100644 index 00000000000..618cf4bdd9a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/response/ResponsesDeserializer.hbs @@ -0,0 +1,11 @@ +package {{{packageName}}}.response; + +import {{{packageName}}}.configurations.SchemaConfiguration; +import java.net.http.HttpResponse; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.ApiException; + +public interface ResponsesDeserializer { + SealedResponseClass deserialize(HttpResponse response, SchemaConfiguration configuration) throws ValidationException, NotImplementedException, ApiException; +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/restclient/RestClient.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/restclient/RestClient.hbs new file mode 100644 index 00000000000..810e700f2e4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/restclient/RestClient.hbs @@ -0,0 +1,67 @@ +package {{packageName}}.restclient; + +import org.checkerframework.checker.nullness.qual.Nullable; +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +public class RestClient { + public static HttpRequest getRequest( + String serviceUrl, + String method, + HttpRequest.BodyPublisher bodyPublisher, + Map> headers, + @Nullable Duration timeout + ) { + HttpRequest.Builder request = HttpRequest.newBuilder(URI.create(serviceUrl)); + switch (method) { + case "get": + request.GET(); + break; + case "put": + request.method("PUT", bodyPublisher); + break; + case "patch": + request.method("PATCH", bodyPublisher); + break; + case "post": + request.method("POST", bodyPublisher); + break; + case "delete": + request.DELETE(); + break; + case "trace": + request.method("TRACE", bodyPublisher); + break; + case "options": + request.method("OPTIONS", bodyPublisher); + break; + case "head": + request.method("HEAD", bodyPublisher); + break; + case "connect": + request.method("CONNECT", bodyPublisher); + break; + default: + throw new RuntimeException("Invalid http method"); + } + for (Map.Entry> entry: headers.entrySet()) { + String headerName = entry.getKey(); + String headerValue = String.join(", ", entry.getValue()); + request.header(headerName, headerValue); + } + if (timeout != null) { + request.timeout(timeout); + } + return request.build(); + } + + public static HttpResponse getResponse(HttpRequest request, HttpClient client) throws IOException, InterruptedException { + return client.send(request, HttpResponse.BodyHandlers.ofByteArray()); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs new file mode 100644 index 00000000000..67596d88efe --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/AnyTypeJsonSchema.hbs @@ -0,0 +1,358 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NullSchemaValidator +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class AnyTypeJsonSchema { + sealed interface AnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class AnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedNumber(val data: Number) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedString(val data: String) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class AnyTypeJsonSchema1BoxedList(val data: FrozenList) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class AnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : AnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class AnyTypeJsonSchema1 protected constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, StringSchemaValidator, + ListSchemaValidator, AnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, AnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedVoid { + return AnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedBoolean { + return AnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedNumber { + return AnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedString { + return AnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedList { + return AnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): AnyTypeJsonSchema1BoxedMap { + return AnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): AnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: AnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: AnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs new file mode 100644 index 00000000000..3750dfaff0a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/BooleanJsonSchema.hbs @@ -0,0 +1,78 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class BooleanJsonSchema { + sealed interface BooleanJsonSchema1Boxed { + fun getData(): Any? + } + + data class BooleanJsonSchema1BoxedBoolean(val data: Boolean) : BooleanJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class BooleanJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Boolean::class.java)) + ), BooleanSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + if (arg is Boolean) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Boolean { + if (arg is Boolean) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): BooleanJsonSchema1BoxedBoolean { + return BooleanJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): BooleanJsonSchema1Boxed { + if (arg is Boolean) { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: BooleanJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: BooleanJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs new file mode 100644 index 00000000000..ceb377593f3 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateJsonSchema.hbs @@ -0,0 +1,87 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import java.time.LocalDate + +open class DateJsonSchema { + sealed interface DateJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateJsonSchema1BoxedString(val data: String) : DateJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is LocalDate) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateJsonSchema1BoxedString { + return DateJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs new file mode 100644 index 00000000000..a05be510b42 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DateTimeJsonSchema.hbs @@ -0,0 +1,87 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import java.time.ZonedDateTime + +open class DateTimeJsonSchema { + sealed interface DateTimeJsonSchema1Boxed { + fun getData(): Any? + } + + data class DateTimeJsonSchema1BoxedString(val data: String) : DateTimeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DateTimeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("date-time") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } else if (arg is ZonedDateTime) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DateTimeJsonSchema1BoxedString { + return DateTimeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DateTimeJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DateTimeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DateTimeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs new file mode 100644 index 00000000000..6171a40e4e5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DecimalJsonSchema.hbs @@ -0,0 +1,78 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class DecimalJsonSchema { + sealed interface DecimalJsonSchema1Boxed { + fun getData(): Any? + } + + data class DecimalJsonSchema1BoxedString(val data: String) : DecimalJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DecimalJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("number") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): DecimalJsonSchema1BoxedString { + return DecimalJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DecimalJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DecimalJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DecimalJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs new file mode 100644 index 00000000000..013cf67c617 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/DoubleJsonSchema.hbs @@ -0,0 +1,92 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class DoubleJsonSchema { + sealed interface DoubleJsonSchema1Boxed { + fun getData(): Any? + } + + data class DoubleJsonSchema1BoxedNumber(val data: Number) : DoubleJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class DoubleJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} + .type(setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + )) + {{else}} + .type(setOf(Double::class.java)) + {{/if}} + .format("double") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): DoubleJsonSchema1BoxedNumber { + return DoubleJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): DoubleJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: DoubleJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: DoubleJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs new file mode 100644 index 00000000000..bd09fff1f20 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/FloatJsonSchema.hbs @@ -0,0 +1,90 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class FloatJsonSchema { + sealed interface FloatJsonSchema1Boxed { + fun getData(): Any? + } + + data class FloatJsonSchema1BoxedNumber(val data: Number) : FloatJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class FloatJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + {{#if generatorSettings.intsAllowedForFloatDoubleFormats}} + .type(setOf( + Int::class.java, + Float::class.java + )) + {{else}} + .type(setOf(Float::class.java)) + {{/if}} + .format("float") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): FloatJsonSchema1BoxedNumber { + return FloatJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): FloatJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: FloatJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: FloatJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs new file mode 100644 index 00000000000..fe3d5f4ae43 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/GenericBuilder.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas + +/** + * Builders must implement this class + * @param the type that the builder returns + */ +interface GenericBuilder { + fun build(): T +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs new file mode 100644 index 00000000000..b231ee210d0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int32JsonSchema.hbs @@ -0,0 +1,93 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class Int32JsonSchema { + sealed interface Int32JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int32JsonSchema1BoxedNumber(val data: Number) : Int32JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int32JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Float::class.java + ) + ) + .format("int32") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int32JsonSchema1BoxedNumber { + return Int32JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int32JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int32JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int32JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs new file mode 100644 index 00000000000..eed468f4a1f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/Int64JsonSchema.hbs @@ -0,0 +1,105 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class Int64JsonSchema { + sealed interface Int64JsonSchema1Boxed { + fun getData(): Any? + } + + data class Int64JsonSchema1BoxedNumber(val data: Number) : Int64JsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class Int64JsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int64") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): Int64JsonSchema1BoxedNumber { + return Int64JsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): Int64JsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: Int64JsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: Int64JsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs new file mode 100644 index 00000000000..6678262375d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/IntJsonSchema.hbs @@ -0,0 +1,105 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class IntJsonSchema { + sealed interface IntJsonSchema1Boxed { + fun getData(): Any? + } + + data class IntJsonSchema1BoxedNumber(val data: Number) : IntJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class IntJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + .format("int") + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): IntJsonSchema1BoxedNumber { + return IntJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): IntJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: IntJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: IntJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs new file mode 100644 index 00000000000..547576d4ae6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/ListJsonSchema.hbs @@ -0,0 +1,98 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class ListJsonSchema { + sealed interface ListJsonSchema1Boxed { + fun getData(): Any? + } + + data class ListJsonSchema1BoxedList(val data: FrozenList) : ListJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class ListJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + ), ListSchemaValidator, ListJsonSchema1BoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: List = pathToItem + i + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ListJsonSchema1BoxedList { + return ListJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ListJsonSchema1Boxed { + if (arg is List<*>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ListJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ListJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs new file mode 100644 index 00000000000..fbd87ba9816 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/MapJsonSchema.hbs @@ -0,0 +1,98 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class MapJsonSchema { + sealed interface MapJsonSchema1Boxed { + fun getData(): Any? + } + + data class MapJsonSchema1BoxedMap(val data: FrozenMap) : MapJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class MapJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + ), MapSchemaValidator, MapJsonSchema1BoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: List = pathToItem + entryKey + val schemas: LinkedHashMap, Nothing?> = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema: JsonSchema<*> = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): MapJsonSchema1BoxedMap { + return MapJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): MapJsonSchema1Boxed { + if (arg is Map<*, *>) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: MapJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: MapJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs new file mode 100644 index 00000000000..57d7990bfeb --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NotAnyTypeJsonSchema.hbs @@ -0,0 +1,379 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NullSchemaValidator +import {{{packageName}}}.schemas.validation.BooleanSchemaValidator +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class NotAnyTypeJsonSchema { + sealed interface NotAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + + data class NotAnyTypeJsonSchema1BoxedVoid(val data: Void?) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + + } + + + data class NotAnyTypeJsonSchema1BoxedNumber(val data: Number) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedString(val data: String) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedList(val data: FrozenList) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + + data class NotAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : NotAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NotAnyTypeJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .not(AnyTypeJsonSchema.AnyTypeJsonSchema1::class.java) + ), NullSchemaValidator, BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, NotAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, NotAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value1, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null as Void?, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null as Void?, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1BoxedVoid { + return NotAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Boolean, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedBoolean { + return NotAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Number, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedNumber { + return NotAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: String, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedString { + return NotAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedList { + return NotAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): NotAnyTypeJsonSchema1BoxedMap { + return NotAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NotAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + var instance: NotAnyTypeJsonSchema1? = null + get() { + if (field == null) { + field = NotAnyTypeJsonSchema1() + } + return field + } + private set + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs new file mode 100644 index 00000000000..46de713d3b7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NullJsonSchema.hbs @@ -0,0 +1,77 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NullSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class NullJsonSchema { + sealed interface NullJsonSchema1Boxed { + fun getData(): Any? + } + + data class NullJsonSchema1BoxedVoid(val data: Nothing?) : NullJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NullJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Void::class.java)) + ), NullSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg == null) { + return getNewInstance(null, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg == null) { + return validate(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): NullJsonSchema1BoxedVoid { + return NullJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NullJsonSchema1Boxed { + if (arg == null) { + return validateAndBox(null, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NullJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NullJsonSchema1().also { instance = it } + } + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs new file mode 100644 index 00000000000..c589c785111 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/NumberJsonSchema.hbs @@ -0,0 +1,104 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.NumberSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +open class NumberJsonSchema { + sealed interface NumberJsonSchema1Boxed { + fun getData(): Any? + } + + data class NumberJsonSchema1BoxedNumber(val data: Number) : NumberJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class NumberJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type( + setOf( + Int::class.java, + Long::class.java, + Float::class.java, + Double::class.java + ) + ) + ), NumberSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Number) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Number { + if (arg is Number) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): NumberJsonSchema1BoxedNumber { + return NumberJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): NumberJsonSchema1Boxed { + if (arg is Number) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: NumberJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: NumberJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs new file mode 100644 index 00000000000..ab6aa26f6a7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/StringJsonSchema.hbs @@ -0,0 +1,111 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +open class StringJsonSchema { + interface StringJsonSchema1Boxed { + fun getData(): Any? + } + + data class StringJsonSchema1BoxedString(val data: String) : StringJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class StringJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + when (arg) { + is UUID -> { + return validate(arg, configuration) + } + + is LocalDate -> { + return validate(arg, configuration) + } + + is ZonedDateTime -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): StringJsonSchema1BoxedString { + return StringJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): StringJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: StringJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: StringJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs new file mode 100644 index 00000000000..fef64c9e967 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UnsetAddPropsSetter.hbs @@ -0,0 +1,81 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException +import {{{packageName}}}.schemas.validation.MapUtils + +interface UnsetAddPropsSetter { + fun getInstance(): MutableMap + fun getKnownKeys(): Set + fun getBuilderAfterAdditionalProperty(instance: MutableMap): T + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Void): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Boolean): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: String): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Int): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Float): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Long): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Double): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: List<*>): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } + + @Throws(InvalidAdditionalPropertyException::class) + fun additionalProperty(key: String, value: Map): T { + MapUtils.throwIfKeyKnown(key, getKnownKeys(), true) + val instance = getInstance() + instance[key] = value + return getBuilderAfterAdditionalProperty(instance) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs new file mode 100644 index 00000000000..ede93de721c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/UuidJsonSchema.hbs @@ -0,0 +1,87 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.StringSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import java.util.UUID + +open class UuidJsonSchema { + sealed interface UuidJsonSchema1Boxed { + fun getData(): Any? + } + + data class UuidJsonSchema1BoxedString(val data: String) : UuidJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + open class UuidJsonSchema1 protected constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + .format("uuid") + ), StringSchemaValidator { + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + if (arg is String) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): String { + if (arg is UUID) { + return validate(arg, configuration) + } else if (arg is String) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UuidJsonSchema1BoxedString { + return UuidJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UuidJsonSchema1Boxed { + if (arg is String) { + return validateAndBox(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: UuidJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UuidJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs new file mode 100644 index 00000000000..de0c81c86e9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AdditionalPropertiesValidator.hbs @@ -0,0 +1,49 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class AdditionalPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val additionalProperties: Class> = data.schema.additionalProperties ?: return null + val presentAdditionalProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentAdditionalProperties.add(key) + } + } + val properties: Map>>? = data.schema.properties + if (properties != null) { + presentAdditionalProperties.removeAll(properties.keys) + } + val pathToSchemas = PathToSchemasMap() + for (addPropName in presentAdditionalProperties) { + val propValue: Any? = data.arg.get(addPropName) + val propPathToItem: List = data.validationMetadata.pathToItem + addPropName + if (data.patternPropertiesPathToSchemas != null && data.patternPropertiesPathToSchemas + .containsKey(propPathToItem) + ) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val addPropsSchema = JsonSchemaFactory.getInstance(additionalProperties) + if (propValidationMetadata.validationRanEarlier(addPropsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(addPropsSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs new file mode 100644 index 00000000000..93bc1983419 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AllOfValidator.hbs @@ -0,0 +1,19 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class AllOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val allOf: List>> = data.schema.allOf ?: return null + val pathToSchemas = PathToSchemasMap() + for (allOfClass in allOf) { + val allOfSchema = JsonSchemaFactory.getInstance(allOfClass) + val otherPathToSchemas = JsonSchema.validate(allOfSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs new file mode 100644 index 00000000000..7e07fb675e9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/AnyOfValidator.hbs @@ -0,0 +1,39 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class AnyOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val anyOf: List>> = data.schema.anyOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedAnyOfClasses: MutableList>> = ArrayList() + for (anyOfClass in anyOf) { + if (anyOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke _validate on it because that is recursive + */ + validatedAnyOfClasses.add(anyOfClass) + continue + } + try { + val anyOfSchema = JsonSchemaFactory.getInstance(anyOfClass) + val otherPathToSchemas = JsonSchema.validate(anyOfSchema, data.arg, data.validationMetadata) + validatedAnyOfClasses.add(anyOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate anyof_classes + } + } + if (validatedAnyOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass.simpleName + ". None " + + "of the anyOf schemas matched the input data." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs new file mode 100644 index 00000000000..587abba4970 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BigDecimalValidator.hbs @@ -0,0 +1,32 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +import java.math.BigDecimal + +abstract class BigDecimalValidator { + @Throws(ValidationException::class) + protected fun getBigDecimal(arg: Number): BigDecimal { + return when (arg) { + is Int -> { + BigDecimal(arg) + } + + is Long -> { + BigDecimal(arg) + } + + is Float -> { + BigDecimal(arg.toString()) + } + + is Double -> { + BigDecimal(arg.toString()) + } + + else -> { + throw ValidationException("Invalid type input for arg") + } + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs new file mode 100644 index 00000000000..4c58f485015 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanEnumValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface BooleanEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Boolean +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs new file mode 100644 index 00000000000..b2a472fc02e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanSchemaValidator.hbs @@ -0,0 +1,12 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface BooleanSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean + + @Throws(ValidationException::class) + fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs new file mode 100644 index 00000000000..0304f1bc033 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/BooleanValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation + +interface BooleanValueMethod { + fun value(): Boolean +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs new file mode 100644 index 00000000000..64bc4e9c261 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ConstValidator.hbs @@ -0,0 +1,31 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +import java.math.BigDecimal + +class ConstValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (!data.schema.constValueSet) { + return null + } + val constValue: Any? = data.schema.constValue + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (castArg == constValue) { + return null + } + if (constValue is BigDecimal && constValue.compareTo(castArg) == 0) { + return null + } + } else { + if (data.arg == constValue) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not equal to const " + constValue) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs new file mode 100644 index 00000000000..ca9b897fa03 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ContainsValidator.hbs @@ -0,0 +1,27 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class ContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List? = data.containsPathToSchemas + if (containsPathToSchemas.isNullOrEmpty()) { + throw ValidationException( + "Validation failed for contains keyword in class=${data.schema.javaClass}" + + " at pathToItem=${data.validationMetadata.pathToItem}. No " + + "items validated to the contains schema." + ) + } + val pathToSchemas = PathToSchemasMap() + for (otherPathToSchema in containsPathToSchemas) { + pathToSchemas.update(otherPathToSchema) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs new file mode 100644 index 00000000000..9577ccef335 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/CustomIsoparser.hbs @@ -0,0 +1,16 @@ +package {{{packageName}}}.schemas.validation + +import java.time.ZonedDateTime +import java.time.LocalDate + +class CustomIsoparser { + companion object { + fun parseIsodatetime(dateTime: String): ZonedDateTime { + return ZonedDateTime.parse(dateTime) + } + + fun parseIsodate(date: String): LocalDate { + return LocalDate.parse(date) + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs new file mode 100644 index 00000000000..233f4681621 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DefaultValueMethod.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +interface DefaultValueMethod { + @Throws(ValidationException::class) + fun defaultValue(): T +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs new file mode 100644 index 00000000000..aa87eca510c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentRequiredValidator.hbs @@ -0,0 +1,36 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class DependentRequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentRequired: Map> = data.schema.dependentRequired ?: return null + for ((key, value) in dependentRequired.entries) { + if (!data.arg.containsKey(key)) { + continue + } + val missingKeys: MutableSet = HashSet(value) + for (objKey in data.arg.keys) { + if (objKey is String) { + missingKeys.remove(objKey) + } + } + if (missingKeys.isEmpty()) { + continue + } + throw ValidationException(""" + |Validation failed for dependentRequired because these_keys=$missingKeys are + | missing at pathToItem=${data.validationMetadata.pathToItem} in class + | ${data.schema.javaClass} + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs new file mode 100644 index 00000000000..0f5bfb12c74 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DependentSchemasValidator.hbs @@ -0,0 +1,31 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class DependentSchemasValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.arg !is Map<*, *>) { + return null + } + val dependentSchemas: Map>> = data.schema.dependentSchemas ?: return null + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, dependentSchemaClass) in dependentSchemas.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val dependentSchema = JsonSchemaFactory.getInstance(dependentSchemaClass) + val otherPathToSchemas = JsonSchema.validate(dependentSchema, data.arg, data.validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs new file mode 100644 index 00000000000..62db4eac999 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleEnumValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface DoubleEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Double +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs new file mode 100644 index 00000000000..9cec46606fd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/DoubleValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation + +interface DoubleValueMethod { + fun value(): Double +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs new file mode 100644 index 00000000000..9f9236a029b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ElseValidator.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class ElseValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val elseSchema: Class> = data.schema.elseSchema ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (!ifPathToSchemas.isEmpty()) { + // if validation is true + return null + } + val elseSchemaInstance = JsonSchemaFactory.getInstance(elseSchema) + val pathToSchemas = PathToSchemasMap() + val elsePathToSchemas = JsonSchema.validate(elseSchemaInstance, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an else error? + pathToSchemas.update(elsePathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs new file mode 100644 index 00000000000..66d7b169bb0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/EnumValidator.hbs @@ -0,0 +1,39 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +import java.math.BigDecimal + +class EnumValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val enumValues: Set = data.schema.enumValues ?: return null + if (enumValues.isEmpty()) { + throw ValidationException("No value can match enum because enum is empty") + } + if (data.arg is Number) { + val castArg = getBigDecimal(data.arg) + if (enumContainsArg(enumValues, castArg)) { + return null + } + for (enumValue in enumValues) { + if (enumValue is BigDecimal && enumValue.compareTo(castArg) == 0) { + return null + } + } + } else { + if (enumContainsArg(enumValues, data.arg)) { + return null + } + } + throw ValidationException("Invalid value " + data.arg + " was not one of the allowed enum " + enumValues) + } + + companion object { + private fun enumContainsArg(enumValues: Set, arg: Any?): Boolean { + return enumValues.contains(arg) + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs new file mode 100644 index 00000000000..0419032fb43 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMaximumValidator.hbs @@ -0,0 +1,43 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class ExclusiveMaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMaximum: Number = data.schema.exclusiveMaximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is >= the exclusiveMaximum of " + exclusiveMaximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMaximum.toInt()) > -1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMaximum.toLong()) > -1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMaximum.toFloat()) > -1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMaximum.toDouble()) > -1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs new file mode 100644 index 00000000000..8eefb7fa1ef --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ExclusiveMinimumValidator.hbs @@ -0,0 +1,43 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class ExclusiveMinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val exclusiveMinimum: Number = data.schema.exclusiveMinimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = + "Value " + data.arg + " is invalid because it is <= the exclusiveMinimum of " + exclusiveMinimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(exclusiveMinimum.toInt()) < 1) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(exclusiveMinimum.toLong()) < 1) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(exclusiveMinimum.toFloat()) < 1) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(exclusiveMinimum.toDouble()) < 1) { + throw ValidationException(msg) + } + } + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs new file mode 100644 index 00000000000..bab089c3378 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatEnumValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface FloatEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Float +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs new file mode 100644 index 00000000000..24b319370ca --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FloatValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation + +interface FloatValueMethod { + fun value(): Float +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs new file mode 100644 index 00000000000..66286724376 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FormatValidator.hbs @@ -0,0 +1,168 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException +import java.math.BigDecimal +import java.math.BigInteger +import java.time.format.DateTimeParseException +import java.util.UUID +import kotlin.math.floor + +class FormatValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val format: String = data.schema.format ?: return null + if (data.arg is Number) { + validateNumericFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } else if (data.arg is String) { + validateStringFormat( + data.arg, + data.validationMetadata, + format + ) + return null + } + return null + } + + companion object { + private val int32InclusiveMinimum = BigInteger.valueOf(-2147483648L) + private val int32InclusiveMaximum = BigInteger.valueOf(2147483647L) + private val int64InclusiveMinimum = BigInteger.valueOf(Long.MIN_VALUE) + private val int64InclusiveMaximum = BigInteger.valueOf(Long.MAX_VALUE) + private val floatInclusiveMinimum = BigDecimal.valueOf(-3.4028234663852886e+38) + private val floatInclusiveMaximum = BigDecimal.valueOf(3.4028234663852886e+38) + private val doubleInclusiveMinimum = BigDecimal.valueOf(-1.7976931348623157E+308) + private val doubleInclusiveMaximum = BigDecimal.valueOf(1.7976931348623157E+308) + @Throws(ValidationException::class) + private fun validateNumericFormat(arg: Number, validationMetadata: ValidationMetadata, format: String) { + if (format.startsWith("int")) { + // there is a json schema test where 1.0 validates as an integer + val intArg: BigInteger + when (arg) { + is Float, is Double -> { + val doubleArg: Double = (arg as? Float)?.toDouble() ?: arg as Double + if (floor(doubleArg) != doubleArg) { + throw ValidationException( + "Invalid non-integer value " + arg + " for format " + format + " at " + validationMetadata.pathToItem + ) + } + intArg = if (arg is Float) { + val smallInt = Math.round(arg) + BigInteger.valueOf(smallInt.toLong()) + } else { + BigInteger.valueOf(Math.round((arg as Double))) + } + } + + is Int -> { + intArg = BigInteger.valueOf(arg.toLong()) + } + + is Long -> { + intArg = BigInteger.valueOf(arg) + } + + else -> { + intArg = arg as BigInteger + } + } + if (format == "int32") { + if (intArg.compareTo(int32InclusiveMinimum) < 0 || intArg.compareTo(int32InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int32 at " + validationMetadata.pathToItem + ) + } + } else if (format == "int64") { + if (intArg.compareTo(int64InclusiveMinimum) < 0 || intArg.compareTo(int64InclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format int64 at " + validationMetadata.pathToItem + ) + } + } + } else if (format == "float" || format == "double") { + val decimalArg: BigDecimal = when (arg) { + is Float -> { + BigDecimal.valueOf(arg.toDouble()) + } + + is Double -> { + BigDecimal.valueOf(arg) + } + + else -> { + arg as BigDecimal + } + } + if (format == "float") { + if (decimalArg.compareTo(floatInclusiveMinimum) < 0 || decimalArg.compareTo(floatInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format float at " + validationMetadata.pathToItem + ) + } + } else { + if (decimalArg.compareTo(doubleInclusiveMinimum) < 0 || decimalArg.compareTo(doubleInclusiveMaximum) > 0) { + throw ValidationException( + "Invalid value " + arg + " for format double at " + validationMetadata.pathToItem + ) + } + } + } + } + + @Throws(ValidationException::class) + private fun validateStringFormat(arg: String, validationMetadata: ValidationMetadata, format: String) { + when (format) { + "uuid" -> { + try { + UUID.fromString(arg) + } catch (e: IllegalArgumentException) { + throw ValidationException( + "Value cannot be converted to a UUID. Invalid value " + + arg + " for format uuid at " + validationMetadata.pathToItem + ) + } + } + + "number" -> { + try { + BigDecimal(arg) + } catch (e: NumberFormatException) { + throw ValidationException( + "Value cannot be converted to a decimal. Invalid value " + + arg + " for format number at " + validationMetadata.pathToItem + ) + } + } + + "date" -> { + try { + CustomIsoparser.parseIsodate(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 date format. " + + "Invalid value " + arg + " for format date at " + validationMetadata.pathToItem + ) + } + } + + "date-time" -> { + try { + CustomIsoparser.parseIsodatetime(arg) + } catch (e: DateTimeParseException) { + throw ValidationException( + "Value does not conform to the required ISO-8601 datetime format. " + + "Invalid value " + arg + " for format datetime at " + validationMetadata.pathToItem + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs new file mode 100644 index 00000000000..b993d5e3958 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenList.hbs @@ -0,0 +1,22 @@ +package {{{packageName}}}.schemas.validation + +open class FrozenList(m: Collection) : AbstractList() { + /* + A frozen List + Once schema validation has been run, indexed access returns values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val list: List + + init { + list = ArrayList(m) + } + + override val size: Int + get() = list.size + + override fun get(index: Int): E { + return list[index] + } +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs new file mode 100644 index 00000000000..e48f5ce3c16 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/FrozenMap.hbs @@ -0,0 +1,44 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.UnsetPropertyException +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException + +open class FrozenMap(m: Map) : AbstractMap() { + /* + A frozen Map + Once schema validation has been run, written accessor methods return values of the correct type + If values were mutable, the types in those methods would not agree with returned values + */ + private val map: Map + + init { + map = HashMap(m) + } + + @Throws(UnsetPropertyException::class) + protected fun getOrThrow(key: String): V? { + if (containsKey(key)) { + return get(key) + } + throw UnsetPropertyException("$key is unset") + } + + @Throws(UnsetPropertyException::class) + protected fun throwIfKeyNotPresent(key: String) { + if (!containsKey(key)) { + throw UnsetPropertyException("$key is unset") + } + } + + @Throws(InvalidAdditionalPropertyException::class) + protected fun throwIfKeyKnown(key: String, requiredKeys: Set, optionalKeys: Set) { + val knownKeys: MutableSet = HashSet() + knownKeys.addAll(requiredKeys) + knownKeys.addAll(optionalKeys) + MapUtils.throwIfKeyKnown(key, knownKeys, false) + } + + override val entries: Set> + get() = map.entries +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs new file mode 100644 index 00000000000..d712b63d3e8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IfValidator.hbs @@ -0,0 +1,26 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class IfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.ifSchema == null) { + return null + } + if (data.ifPathToSchemas == null) { + throw ValidationException("Invalid type for ifPathToSchemas") + } + /* + if is false use case + ifPathToSchemas == {} + no need to add any data to pathToSchemas + + if true, then true -> true for whole schema + so validate_then will add ifPathToSchemas data to pathToSchemas + */ + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs new file mode 100644 index 00000000000..70e33e6e87f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerEnumValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface IntegerEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Int +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs new file mode 100644 index 00000000000..258f4df6118 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/IntegerValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation + +interface IntegerValueMethod { + fun value(): Int +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs new file mode 100644 index 00000000000..7bbcc92d111 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ItemsValidator.hbs @@ -0,0 +1,38 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class ItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val items: Class> = data.schema.items ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val itemsSchema = JsonSchemaFactory.getInstance(items) + for (i in minIndex until data.arg.size) { + val itemPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + itemPathToItem.add(i) + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(itemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs new file mode 100644 index 00000000000..73f6f421a19 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchema.hbs @@ -0,0 +1,512 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +import java.math.BigDecimal +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.regex.Pattern +import java.util.UUID + +abstract class JsonSchema protected constructor(jsonSchemaInfo: JsonSchemaInfo) { + val type: Set>? + val format: String? + val items: Class>? + val properties: Map>>? + val required: Set? + val exclusiveMaximum: Number? + val exclusiveMinimum: Number? + val maxItems: Int? + val minItems: Int? + val maxLength: Int? + val minLength: Int? + val maxProperties: Int? + val minProperties: Int? + val maximum: Number? + val minimum: Number? + val multipleOf: BigDecimal? + val additionalProperties: Class>? + val allOf: List>>? + val anyOf: List>>? + val oneOf: List>>? + val not: Class>? + val uniqueItems: Boolean? + val enumValues: Set? + val pattern: Pattern? + val defaultValue: Any? + val defaultValueSet: Boolean + val constValue: Any? + val constValueSet: Boolean + val contains: Class>? + val maxContains: Int? + val minContains: Int? + val propertyNames: Class>? + val dependentRequired: Map>? + val dependentSchemas: Map>>? + val patternProperties: Map>>? + val prefixItems: List>>? + val ifSchema: Class>? + val then: Class>? + val elseSchema: Class>? + val unevaluatedItems: Class>? + val unevaluatedProperties: Class>? + private val keywordToValidator: LinkedHashMap + + init { + val keywordToValidator = LinkedHashMap() + type = jsonSchemaInfo.type + if (type != null) { + keywordToValidator["type"] = TypeValidator() + } + format = jsonSchemaInfo.format + if (format != null) { + keywordToValidator["format"] = FormatValidator() + } + items = jsonSchemaInfo.items + if (items != null) { + keywordToValidator["items"] = ItemsValidator() + } + properties = jsonSchemaInfo.properties + if (properties != null) { + keywordToValidator["properties"] = PropertiesValidator() + } + required = jsonSchemaInfo.required + if (required != null) { + keywordToValidator["required"] = RequiredValidator() + } + exclusiveMaximum = jsonSchemaInfo.exclusiveMaximum + if (exclusiveMaximum != null) { + keywordToValidator["exclusiveMaximum"] = ExclusiveMaximumValidator() + } + exclusiveMinimum = jsonSchemaInfo.exclusiveMinimum + if (exclusiveMinimum != null) { + keywordToValidator["exclusiveMinimum"] = ExclusiveMinimumValidator() + } + maxItems = jsonSchemaInfo.maxItems + if (maxItems != null) { + keywordToValidator["maxItems"] = MaxItemsValidator() + } + minItems = jsonSchemaInfo.minItems + if (minItems != null) { + keywordToValidator["minItems"] = MinItemsValidator() + } + maxLength = jsonSchemaInfo.maxLength + if (maxLength != null) { + keywordToValidator["maxLength"] = MaxLengthValidator() + } + minLength = jsonSchemaInfo.minLength + if (minLength != null) { + keywordToValidator["minLength"] = MinLengthValidator() + } + maxProperties = jsonSchemaInfo.maxProperties + if (maxProperties != null) { + keywordToValidator["maxProperties"] = MaxPropertiesValidator() + } + minProperties = jsonSchemaInfo.minProperties + if (minProperties != null) { + keywordToValidator["minProperties"] = MinPropertiesValidator() + } + maximum = jsonSchemaInfo.maximum + if (maximum != null) { + keywordToValidator["maximum"] = MaximumValidator() + } + minimum = jsonSchemaInfo.minimum + if (minimum != null) { + keywordToValidator["minimum"] = MinimumValidator() + } + multipleOf = jsonSchemaInfo.multipleOf + if (multipleOf != null) { + keywordToValidator["multipleOf"] = MultipleOfValidator() + } + additionalProperties = jsonSchemaInfo.additionalProperties + if (additionalProperties != null) { + keywordToValidator["additionalProperties"] = AdditionalPropertiesValidator() + } + allOf = jsonSchemaInfo.allOf + if (allOf != null) { + keywordToValidator["allOf"] = AllOfValidator() + } + anyOf = jsonSchemaInfo.anyOf + if (anyOf != null) { + keywordToValidator["anyOf"] = AnyOfValidator() + } + oneOf = jsonSchemaInfo.oneOf + if (oneOf != null) { + keywordToValidator["oneOf"] = OneOfValidator() + } + not = jsonSchemaInfo.not + if (not != null) { + keywordToValidator["not"] = NotValidator() + } + uniqueItems = jsonSchemaInfo.uniqueItems + if (uniqueItems != null) { + keywordToValidator["uniqueItems"] = UniqueItemsValidator() + } + enumValues = jsonSchemaInfo.enumValues + if (enumValues != null) { + keywordToValidator["enum"] = EnumValidator() + } + pattern = jsonSchemaInfo.pattern + if (pattern != null) { + keywordToValidator["pattern"] = PatternValidator() + } + defaultValue = jsonSchemaInfo.defaultValue + defaultValueSet = jsonSchemaInfo.defaultValueSet + constValue = jsonSchemaInfo.constValue + constValueSet = jsonSchemaInfo.constValueSet + if (constValueSet) { + keywordToValidator["const"] = ConstValidator() + } + contains = jsonSchemaInfo.contains + if (contains != null) { + keywordToValidator["contains"] = ContainsValidator() + } + maxContains = jsonSchemaInfo.maxContains + if (maxContains != null) { + keywordToValidator["maxContains"] = MaxContainsValidator() + } + minContains = jsonSchemaInfo.minContains + if (minContains != null) { + keywordToValidator["minContains"] = MinContainsValidator() + } + propertyNames = jsonSchemaInfo.propertyNames + if (propertyNames != null) { + keywordToValidator["propertyNames"] = PropertyNamesValidator() + } + dependentRequired = jsonSchemaInfo.dependentRequired + if (dependentRequired != null) { + keywordToValidator["dependentRequired"] = DependentRequiredValidator() + } + dependentSchemas = jsonSchemaInfo.dependentSchemas + if (dependentSchemas != null) { + keywordToValidator["dependentSchemas"] = DependentSchemasValidator() + } + patternProperties = jsonSchemaInfo.patternProperties + if (patternProperties != null) { + keywordToValidator["patternProperties"] = PatternPropertiesValidator() + } + prefixItems = jsonSchemaInfo.prefixItems + if (prefixItems != null) { + keywordToValidator["prefixItems"] = PrefixItemsValidator() + } + ifSchema = jsonSchemaInfo.ifSchema + if (ifSchema != null) { + keywordToValidator["if"] = IfValidator() + } + then = jsonSchemaInfo.then + if (then != null) { + keywordToValidator["then"] = ThenValidator() + } + elseSchema = jsonSchemaInfo.elseSchema + if (elseSchema != null) { + keywordToValidator["else"] = ElseValidator() + } + unevaluatedItems = jsonSchemaInfo.unevaluatedItems + if (unevaluatedItems != null) { + keywordToValidator["unevaluatedItems"] = UnevaluatedItemsValidator() + } + unevaluatedProperties = jsonSchemaInfo.unevaluatedProperties + if (unevaluatedProperties != null) { + keywordToValidator["unevaluatedProperties"] = UnevaluatedPropertiesValidator() + } + this.keywordToValidator = keywordToValidator + } + + abstract fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? + @Throws(ValidationException::class) + abstract fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? + @Throws(ValidationException::class) + abstract fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): T + private fun getContainsPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): List { + if (arg !is List<*> || contains == null) { + return ArrayList() + } + val containsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(contains) + val containsPathToSchemas: MutableList = ArrayList() + for (i in arg.indices) { + val thesePathToSchemas = PathToSchemasMap() + val itemPathToItem: List = validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(containsSchema)) { + // todo add_deeper_validated_schemas + containsPathToSchemas.add(thesePathToSchemas) + continue + } + try { + val otherPathToSchemas = validate( + containsSchema, arg[i], itemValidationMetadata + ) + containsPathToSchemas.add(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + } + return containsPathToSchemas + } + + @Throws(ValidationException::class) + private fun getPatternPropertiesPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (arg !is Map<*, *> || patternProperties == null) { + return PathToSchemasMap() + } + val pathToSchemas = PathToSchemasMap() + for ((key, value) in arg) { + val entryKey = key!! as? String + ?: throw ValidationException("Invalid non-string type for map key") + val propPathToItem: List = validationMetadata.pathToItem + entryKey + val propValidationMetadata = ValidationMetadata( + propPathToItem, + validationMetadata.configuration, + validationMetadata.validatedPathToSchemas, + validationMetadata.seenClasses + ) + for ((key1, patternPropClass) in patternProperties) { + if (!key1.matcher(entryKey).find()) { + continue + } + val patternPropSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(patternPropClass) + val otherPathToSchemas = validate(patternPropSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + } + return pathToSchemas + } + + private fun getIfPathToSchemas( + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + if (ifSchema == null) { + return PathToSchemasMap() + } + val ifSchemaInstance: JsonSchema<*> = JsonSchemaFactory.getInstance(ifSchema) + val pathToSchemas = PathToSchemasMap() + try { + val otherPathToSchemas = validate(ifSchemaInstance, arg, validationMetadata) + pathToSchemas.update(otherPathToSchemas) + } catch (ignored: ValidationException) { + } + return pathToSchemas + } + + protected fun castToAllowedTypes(arg: String, pathToItem: List, pathSet: MutableSet>): String { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Boolean, pathToItem: List, pathSet: MutableSet>): Boolean { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Number, pathToItem: List, pathSet: MutableSet>): Number { + pathSet.add(pathToItem) + return arg + } + + protected fun castToAllowedTypes(arg: Nothing?, pathToItem: List, pathSet: MutableSet>): Nothing? { + pathSet.add(pathToItem) + return arg + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes(arg: List<*>, pathToItem: List, pathSet: MutableSet>): List<*> { + pathSet.add(pathToItem) + val argFixed: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val newPathToItem: List = pathToItem + i + val fixedVal = castToAllowedObjectTypes(item, newPathToItem, pathSet) + argFixed.add(fixedVal) + i += 1 + } + return argFixed + } + + @Throws(ValidationException::class) + protected fun castToAllowedTypes( + arg: Map<*, *>, + pathToItem: List, + pathSet: MutableSet> + ): Map<*, *> { + pathSet.add(pathToItem) + val argFixed = LinkedHashMap() + for ((entryKey, value) in arg) { + if (entryKey !is String) { + throw ValidationException("Invalid non-string key value") + } + val newPathToItem: List = pathToItem + entryKey + val fixedVal = castToAllowedObjectTypes(value, newPathToItem, pathSet) + argFixed[entryKey] = fixedVal + } + return argFixed + } + + @Throws(ValidationException::class) + private fun castToAllowedObjectTypes(arg: Any?, pathToItem: List, pathSet: MutableSet>): Any? { + return when (arg) { + null -> { + castToAllowedTypes(null, pathToItem, pathSet) + } + is String -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Map<*, *> -> { + pathSet.add(pathToItem) + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Boolean -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is Number -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is List<*> -> { + castToAllowedTypes(arg, pathToItem, pathSet) + } + + is ZonedDateTime -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is LocalDate -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + is UUID -> { + castToAllowedTypes(arg.toString(), pathToItem, pathSet) + } + + else -> { + val argClass = arg.javaClass + throw ValidationException("Invalid type passed in for input=$arg type=$argClass") + } + } + } + + protected fun getNewInstance(arg: Nothing?, pathToItem: List, pathToSchemas: PathToSchemasMap): Nothing? { + return arg + } + + protected fun getNewInstance(arg: Boolean, pathToItem: List, pathToSchemas: PathToSchemasMap): Boolean { + return arg + } + + protected fun getNewInstance(arg: Number, pathToItem: List, pathToSchemas: PathToSchemasMap): Number { + return arg + } + + protected fun getNewInstance(arg: String, pathToItem: List, pathToSchemas: PathToSchemasMap): String { + return arg + } + + companion object { + @Throws(ValidationException::class) + fun validate( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata + ): PathToSchemasMap { + val disabledKeywords: LinkedHashSet = + validationMetadata.configuration.disabledKeywordFlags.keywords + val pathToSchemas = PathToSchemasMap() + val thisKeywordToValidator = jsonSchema.keywordToValidator + var containsPathToSchemas: List? = null + if (thisKeywordToValidator.containsKey("contains")) { + containsPathToSchemas = jsonSchema.getContainsPathToSchemas(arg, validationMetadata) + } + var patternPropertiesPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("patternProperties")) { + patternPropertiesPathToSchemas = jsonSchema.getPatternPropertiesPathToSchemas(arg, validationMetadata) + } + var ifPathToSchemas: PathToSchemasMap? = null + if (thisKeywordToValidator.containsKey("if")) { + ifPathToSchemas = jsonSchema.getIfPathToSchemas(arg, validationMetadata) + } + var knownPathToSchemas: PathToSchemasMap? = null + for ((jsonKeyword, validator) in thisKeywordToValidator) { + if (disabledKeywords.contains(jsonKeyword)) { + val typeIntegerUseCase = jsonKeyword == "format" && "int" == jsonSchema.format + if (!typeIntegerUseCase) { + continue + } + } + if ("unevaluatedItems" == jsonKeyword || "unevaluatedProperties" == jsonKeyword) { + knownPathToSchemas = pathToSchemas + } + val data = ValidationData( + jsonSchema, + arg, + validationMetadata, + containsPathToSchemas, + patternPropertiesPathToSchemas, + ifPathToSchemas, + knownPathToSchemas + ) + val otherPathToSchemas = validator.validate(data) ?: continue + pathToSchemas.update(otherPathToSchemas) + } + val pathToItem: List = validationMetadata.pathToItem + if (!pathToSchemas.containsKey(pathToItem)) { + pathToSchemas[validationMetadata.pathToItem] = LinkedHashMap() + } + val schemas: LinkedHashMap, Nothing?>? = pathToSchemas[pathToItem] + if (schemas != null) { + schemas[jsonSchema] = null + } + return pathToSchemas + } + + @JvmStatic + @Throws(ValidationException::class) + protected fun getPathToSchemas( + jsonSchema: JsonSchema<*>, + arg: Any?, + validationMetadata: ValidationMetadata, + pathSet: Set> + ): PathToSchemasMap { + val pathToSchemasMap = PathToSchemasMap() + // todo add check of validationMetadata.validationRanEarlier(this) + val otherPathToSchemas = validate(jsonSchema, arg, validationMetadata) + pathToSchemasMap.update(otherPathToSchemas) + for (schemas in pathToSchemasMap.values) { + val firstSchema: JsonSchema<*> = schemas.entries.iterator().next().key + schemas.clear() + schemas[firstSchema] = null + } + val mutPathSet: MutableSet> = pathSet.toMutableSet() + mutPathSet.removeAll(pathToSchemasMap.keys) + if (mutPathSet.isNotEmpty()) { + val unsetAnyTypeSchema = LinkedHashMap, Nothing?>() + unsetAnyTypeSchema[UnsetAnyTypeJsonSchema.UnsetAnyTypeJsonSchema1.getInstance()] = null + for (pathToItem in mutPathSet) { + pathToSchemasMap[pathToItem] = unsetAnyTypeSchema + } + } + return pathToSchemasMap + } + + fun getClass(arg: Any?): String { + return if (arg == null) { + Void::class.java.getSimpleName() + } else { + arg.javaClass.getSimpleName() + } + } // todo add bytes and FileIO + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs new file mode 100644 index 00000000000..e8d908d9d21 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaFactory.hbs @@ -0,0 +1,30 @@ +package {{{packageName}}}.schemas.validation + +import java.lang.reflect.InvocationTargetException + +object JsonSchemaFactory { + private var classToInstance: MutableMap>, JsonSchema<*>> = HashMap() + + fun > getInstance(schemaCls: Class): V { + val cacheInst: JsonSchema<*>? = classToInstance[schemaCls] + cacheInst?.let { + assert(schemaCls.isInstance(it)) + return schemaCls.cast(it) + } + try { + val companion = schemaCls.declaredClasses[0] + val method = companion.getMethod("getInstance") + val obj = method.invoke(companion.kotlin.objectInstance) + assert(schemaCls.isInstance(obj)) + val inst = schemaCls.cast(obj) + classToInstance[schemaCls] = inst + return inst + } catch (e: NoSuchMethodException) { + throw RuntimeException(e) + } catch (e: IllegalAccessException) { + throw RuntimeException(e) + } catch (e: InvocationTargetException) { + throw RuntimeException(e) + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs new file mode 100644 index 00000000000..782c17f848f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/JsonSchemaInfo.hbs @@ -0,0 +1,244 @@ +package {{{packageName}}}.schemas.validation + +import java.math.BigDecimal +import java.util.regex.Pattern + +class JsonSchemaInfo { + var type: Set>? = null + fun type(type: Set>): JsonSchemaInfo { + this.type = type + return this + } + + var format: String? = null + fun format(format: String): JsonSchemaInfo { + this.format = format + return this + } + + var items: Class>? = null + fun items(items: Class>): JsonSchemaInfo { + this.items = items + return this + } + + var properties: Map>>? = null + fun properties(properties: Map>>): JsonSchemaInfo { + this.properties = properties + return this + } + + var required: Set? = null + fun required(required: Set): JsonSchemaInfo { + this.required = required + return this + } + + var exclusiveMaximum: Number? = null + fun exclusiveMaximum(exclusiveMaximum: Number): JsonSchemaInfo { + this.exclusiveMaximum = exclusiveMaximum + return this + } + + var exclusiveMinimum: Number? = null + fun exclusiveMinimum(exclusiveMinimum: Number): JsonSchemaInfo { + this.exclusiveMinimum = exclusiveMinimum + return this + } + + var maxItems: Int? = null + fun maxItems(maxItems: Int): JsonSchemaInfo { + this.maxItems = maxItems + return this + } + + var minItems: Int? = null + fun minItems(minItems: Int): JsonSchemaInfo { + this.minItems = minItems + return this + } + + var maxLength: Int? = null + fun maxLength(maxLength: Int): JsonSchemaInfo { + this.maxLength = maxLength + return this + } + + var minLength: Int? = null + fun minLength(minLength: Int): JsonSchemaInfo { + this.minLength = minLength + return this + } + + var maxProperties: Int? = null + fun maxProperties(maxProperties: Int): JsonSchemaInfo { + this.maxProperties = maxProperties + return this + } + + var minProperties: Int? = null + fun minProperties(minProperties: Int): JsonSchemaInfo { + this.minProperties = minProperties + return this + } + + var maximum: Number? = null + fun maximum(maximum: Number): JsonSchemaInfo { + this.maximum = maximum + return this + } + + var minimum: Number? = null + fun minimum(minimum: Number): JsonSchemaInfo { + this.minimum = minimum + return this + } + + var multipleOf: BigDecimal? = null + fun multipleOf(multipleOf: BigDecimal): JsonSchemaInfo { + this.multipleOf = multipleOf + return this + } + + var additionalProperties: Class>? = null + fun additionalProperties(additionalProperties: Class>): JsonSchemaInfo { + this.additionalProperties = additionalProperties + return this + } + + var allOf: List>>? = null + fun allOf(allOf: List>>): JsonSchemaInfo { + this.allOf = allOf + return this + } + + var anyOf: List>>? = null + fun anyOf(anyOf: List>>): JsonSchemaInfo { + this.anyOf = anyOf + return this + } + + var oneOf: List>>? = null + fun oneOf(oneOf: List>>): JsonSchemaInfo { + this.oneOf = oneOf + return this + } + + var not: Class>? = null + fun not(not: Class>): JsonSchemaInfo { + this.not = not + return this + } + + var uniqueItems: Boolean? = null + fun uniqueItems(uniqueItems: Boolean): JsonSchemaInfo { + this.uniqueItems = uniqueItems + return this + } + + var enumValues: Set? = null + fun enumValues(enumValues: Set): JsonSchemaInfo { + this.enumValues = enumValues + return this + } + + var pattern: Pattern? = null + fun pattern(pattern: Pattern): JsonSchemaInfo { + this.pattern = pattern + return this + } + + var defaultValue: Any? = null + var defaultValueSet = false + fun defaultValue(defaultValue: Any?): JsonSchemaInfo { + this.defaultValue = defaultValue + defaultValueSet = true + return this + } + + var constValue: Any? = null + var constValueSet = false + fun constValue(constValue: Any?): JsonSchemaInfo { + this.constValue = constValue + constValueSet = true + return this + } + + var contains: Class>? = null + fun contains(contains: Class>): JsonSchemaInfo { + this.contains = contains + return this + } + + var maxContains: Int? = null + fun maxContains(maxContains: Int): JsonSchemaInfo { + this.maxContains = maxContains + return this + } + + var minContains: Int? = null + fun minContains(minContains: Int): JsonSchemaInfo { + this.minContains = minContains + return this + } + + var propertyNames: Class>? = null + fun propertyNames(propertyNames: Class>): JsonSchemaInfo { + this.propertyNames = propertyNames + return this + } + + var dependentRequired: Map>? = null + fun dependentRequired(dependentRequired: Map>): JsonSchemaInfo { + this.dependentRequired = dependentRequired + return this + } + + var dependentSchemas: Map>>? = null + fun dependentSchemas(dependentSchemas: Map>>): JsonSchemaInfo { + this.dependentSchemas = dependentSchemas + return this + } + + var patternProperties: Map>>? = null + fun patternProperties(patternProperties: Map>>): JsonSchemaInfo { + this.patternProperties = patternProperties + return this + } + + var prefixItems: List>>? = null + fun prefixItems(prefixItems: List>>): JsonSchemaInfo { + this.prefixItems = prefixItems + return this + } + + var ifSchema: Class>? = null + fun ifSchema(ifSchema: Class>): JsonSchemaInfo { + this.ifSchema = ifSchema + return this + } + + var then: Class>? = null + fun then(then: Class>): JsonSchemaInfo { + this.then = then + return this + } + + var elseSchema: Class>? = null + fun elseSchema(elseSchema: Class>): JsonSchemaInfo { + this.elseSchema = elseSchema + return this + } + + var unevaluatedItems: Class>? = null + fun unevaluatedItems(unevaluatedItems: Class>): JsonSchemaInfo { + this.unevaluatedItems = unevaluatedItems + return this + } + + var unevaluatedProperties: Class>? = null + fun unevaluatedProperties(unevaluatedProperties: Class>): JsonSchemaInfo { + this.unevaluatedProperties = unevaluatedProperties + return this + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs new file mode 100644 index 00000000000..ca41c306325 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordEntry.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.schemas.validation + +import java.util.AbstractMap + +class KeywordEntry(key: String, value: KeywordValidator) : + AbstractMap.SimpleEntry(key, value) diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs new file mode 100644 index 00000000000..b48ee727513 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/KeywordValidator.hbs @@ -0,0 +1,10 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +fun interface KeywordValidator { + @Throws(ValidationException::class) + fun validate( + data: ValidationData + ): PathToSchemasMap? +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs new file mode 100644 index 00000000000..dab328d0f7c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LengthValidator.hbs @@ -0,0 +1,16 @@ +package {{{packageName}}}.schemas.validation + +import java.text.BreakIterator + +abstract class LengthValidator { + protected fun getLength(text: String?): Int { + var graphemeCount = 0 + val graphemeCounter = BreakIterator + .getCharacterInstance() + graphemeCounter.setText(text) + while (graphemeCounter.next() != BreakIterator.DONE) { + graphemeCount++ + } + return graphemeCount + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs new file mode 100644 index 00000000000..3b76acdb91b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListMaker.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.schemas.validation + +import java.util.ArrayList +import java.util.Arrays +import java.util.List + +public class ListMaker { + /** + * A builder for lists that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param value type + */ + @SafeVarargs + @SuppressWarnings("varargs") + public static List makeList(E... entries) { + return new ArrayList<>(Arrays.stream(entries).toList()) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs new file mode 100644 index 00000000000..b6fc1529a8d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ListSchemaValidator.hbs @@ -0,0 +1,15 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface ListSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: List<*>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs new file mode 100644 index 00000000000..7cb21bf49b2 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongEnumValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface LongEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Long +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs new file mode 100644 index 00000000000..e697905e149 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/LongValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation + +interface LongValueMethod { + fun value(): Long +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs new file mode 100644 index 00000000000..8c52d6bc351 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapSchemaValidator.hbs @@ -0,0 +1,15 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface MapSchemaValidator { + @Throws(ValidationException::class) + fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): OutType + + @Throws(ValidationException::class) + fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): OutType + + @Throws(ValidationException::class) + fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): BoxedType +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs new file mode 100644 index 00000000000..b1943ff3dd9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MapUtils.hbs @@ -0,0 +1,35 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.InvalidAdditionalPropertyException + +class MapUtils { + companion object { + /** + * A builder for maps that allows in null values + * Schema tests + doc code samples need it + * @param entries items to add + * @return the output map + * @param key type + * @param value type + */ + @SafeVarargs + fun makeMap(vararg entries: Map.Entry): Map { + val map: MutableMap = HashMap() + for ((key, value) in entries) { + map[key] = value + } + return map + } + + @Throws(InvalidAdditionalPropertyException::class) + fun throwIfKeyKnown(key: String, knownKeys: Set, setting: Boolean) { + if (knownKeys.contains(key)) { + var verb = "getting" + if (setting) { + verb = "setting" + } + throw InvalidAdditionalPropertyException("The known key $key may not be passed in when $verb an additional property") + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs new file mode 100644 index 00000000000..b8d2c2a0024 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxContainsValidator.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MaxContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxContains: Int = data.schema.maxContains ?: return null + if (data.arg !is List<*>) { + return null + } + val containsPathToSchemas: List = data.containsPathToSchemas ?: return null + if (containsPathToSchemas.size > maxContains) { + throw ValidationException(""" + |Validation failed for maxContains keyword in class=${data.schema.javaClass} + | at pathToItem=${data.validationMetadata.pathToItem}. Too many items" + | validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs new file mode 100644 index 00000000000..a5b8c62883e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxItemsValidator.hbs @@ -0,0 +1,19 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MaxItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxItems: Int = data.schema.maxItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size > maxItems) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxItems of $maxItems") + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs new file mode 100644 index 00000000000..49fc7f54203 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxLengthValidator.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MaxLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxLength: Int = data.schema.maxLength ?: return null + if (data.arg !is String) { + return null + } + val length: Int = getLength(data.arg) + if (length > maxLength) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxLength of $maxLength") + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs new file mode 100644 index 00000000000..5036a3c3c78 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaxPropertiesValidator.hbs @@ -0,0 +1,19 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MaxPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maxProperties: Int = data.schema.maxProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size > maxProperties) { + throw ValidationException("Value ${data.arg} is invalid because has > the maxProperties of $maxProperties") + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs new file mode 100644 index 00000000000..de5b60eba1f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MaximumValidator.hbs @@ -0,0 +1,42 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MaximumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val maximum: Number = data.schema.maximum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is > the maximum of " + maximum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(maximum.toInt()) > 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(maximum.toLong()) > 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(maximum.toFloat()) > 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(maximum.toDouble()) > 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs new file mode 100644 index 00000000000..300bdfff8cf --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinContainsValidator.hbs @@ -0,0 +1,27 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MinContainsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minContains: Int = data.schema.minContains ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.containsPathToSchemas == null) { + return null + } + if (data.containsPathToSchemas.size < minContains) { + throw ValidationException(""" + |Validation failed for minContains keyword in class=${data.schema.javaClass} at + | pathToItem=${data.validationMetadata.pathToItem}. + | Too few items validated to the contains schema. + """.trimMargin() + ) + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs new file mode 100644 index 00000000000..47f3c8efba7 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinItemsValidator.hbs @@ -0,0 +1,19 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MinItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minItems: Int = data.schema.minItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.size < minItems) { + throw ValidationException("Value ${data.arg} is invalid because has < the minItems of $minItems") + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs new file mode 100644 index 00000000000..51bcaa41e6e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinLengthValidator.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MinLengthValidator : LengthValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minLength: Int = data.schema.minLength ?: return null + if (data.arg !is String) { + return null + } + val length = getLength(data.arg) + if (length < minLength) { + throw ValidationException("Value ${data.arg} is invalid because has < the minLength of $minLength") + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs new file mode 100644 index 00000000000..37c53191968 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinPropertiesValidator.hbs @@ -0,0 +1,19 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MinPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minProperties: Int = data.schema.minProperties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + if (data.arg.size < minProperties) { + throw ValidationException("Value ${data.arg} is invalid because has < the minProperties of $minProperties") + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs new file mode 100644 index 00000000000..770b9ea4fac --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MinimumValidator.hbs @@ -0,0 +1,42 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class MinimumValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val minimum: Number = data.schema.minimum ?: return null + if (data.arg !is Number) { + return null + } + val msg = "Value " + data.arg + " is invalid because it is < the minimum of " + minimum + when (data.arg) { + is Int -> { + if (data.arg.compareTo(minimum.toInt()) < 0) { + throw ValidationException(msg) + } + } + + is Long -> { + if (data.arg.compareTo(minimum.toLong()) < 0) { + throw ValidationException(msg) + } + } + + is Float -> { + if (data.arg.compareTo(minimum.toFloat()) < 0) { + throw ValidationException(msg) + } + } + + is Double -> { + if (data.arg.compareTo(minimum.toDouble()) < 0) { + throw ValidationException(msg) + } + } + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs new file mode 100644 index 00000000000..9f5fafaa395 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/MultipleOfValidator.hbs @@ -0,0 +1,23 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +import java.math.BigDecimal + +class MultipleOfValidator : BigDecimalValidator(), KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val multipleOf: BigDecimal = data.schema.multipleOf ?: return null + if (data.arg !is Number) { + return null + } + val castArg: BigDecimal = getBigDecimal(data.arg) + val msg = "Value ${data.arg} is invalid because it is not a multiple of $multipleOf" + if (castArg.remainder(multipleOf).compareTo(BigDecimal.ZERO) != 0) { + throw ValidationException(msg) + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs new file mode 100644 index 00000000000..5dc57ee0643 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NotValidator.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class NotValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val not: Class> = data.schema.not ?: return null + val pathToSchemas: PathToSchemasMap = try { + val notSchema = JsonSchemaFactory.getInstance(not) + JsonSchema.validate(notSchema, data.arg, data.validationMetadata) + } catch (e: ValidationException) { + return null + } + if (!pathToSchemas.isEmpty()) { + throw ValidationException( + "Invalid value " + data.arg + " was passed in to " + data.schema.javaClass + + ". Value is invalid because it is disallowed by not " + not + ) + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs new file mode 100644 index 00000000000..ee7fd6ffa92 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullEnumValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface NullEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): Nothing? +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs new file mode 100644 index 00000000000..32287211004 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullSchemaValidator.hbs @@ -0,0 +1,12 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface NullSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? + + @Throws(ValidationException::class) + fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs new file mode 100644 index 00000000000..4dae932a14c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NullValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation + +interface NullValueMethod { + fun value(): Nothing? +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs new file mode 100644 index 00000000000..66fbdace17b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/NumberSchemaValidator.hbs @@ -0,0 +1,12 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface NumberSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: Number, configuration: SchemaConfiguration?): Number + + @Throws(ValidationException::class) + fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs new file mode 100644 index 00000000000..2b92eba1d9b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/OneOfValidator.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class OneOfValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val oneOf: List>> = data.schema.oneOf ?: return null + val pathToSchemas = PathToSchemasMap() + val validatedOneOfClasses: MutableList>> = ArrayList() + for (oneOfClass in oneOf) { + if (oneOfClass == data.schema.javaClass) { + /* + optimistically assume that schema will pass validation + do not invoke validate on it because that is recursive + */ + validatedOneOfClasses.add(oneOfClass) + continue + } + try { + val oneOfSchema = JsonSchemaFactory.getInstance(oneOfClass) + val otherPathToSchemas = JsonSchema.validate(oneOfSchema, data.arg, data.validationMetadata) + validatedOneOfClasses.add(oneOfClass) + pathToSchemas.update(otherPathToSchemas) + } catch (e: ValidationException) { + // silence exceptions because the code needs to accumulate validatedOneOfClasses + } + } + if (validatedOneOfClasses.isEmpty()) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + ". None " + + "of the oneOf schemas matched the input data." + ) + } + if (validatedOneOfClasses.size > 1) { + throw ValidationException( + "Invalid inputs given to generate an instance of " + data.schema.javaClass + + ". Multiple oneOf schemas validated the data, but a max of one is allowed." + ) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs new file mode 100644 index 00000000000..206c726cab9 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PathToSchemasMap.hbs @@ -0,0 +1,13 @@ +package {{{packageName}}}.schemas.validation + +class PathToSchemasMap : LinkedHashMap, LinkedHashMap, Nothing?>>() { + fun update(other: PathToSchemasMap) { + for ((pathToItem, otherSchemas) in other) { + if (containsKey(pathToItem)) { + get(pathToItem)!!.putAll(otherSchemas) + } else { + put(pathToItem, otherSchemas) + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs new file mode 100644 index 00000000000..c27a1acbc85 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternPropertiesValidator.hbs @@ -0,0 +1,15 @@ +package {{{packageName}}}.schemas.validation + +class PatternPropertiesValidator : KeywordValidator { + override fun validate( + data: ValidationData + ): PathToSchemasMap? + { + if (data.schema.patternProperties == null) { + return null + } + return if (data.arg !is Map<*, *>) { + null + } else data.patternPropertiesPathToSchemas + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs new file mode 100644 index 00000000000..0708f8721d4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PatternValidator.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +import java.util.regex.Pattern + +class PatternValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val pattern: Pattern = data.schema.pattern ?: return null + if (data.arg !is String) { + return null + } + if (!pattern.matcher(data.arg).find()) { + throw ValidationException("Invalid value ${data.arg} did not find a match for pattern $pattern") + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs new file mode 100644 index 00000000000..6d6253f4885 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PrefixItemsValidator.hbs @@ -0,0 +1,35 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +import kotlin.math.min + +class PrefixItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val prefixItems: List>> = data.schema.prefixItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val maxIndex: Int = min(data.arg.size, prefixItems.size) + for (i in 0 until maxIndex) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val itemsSchema: JsonSchema<*> = JsonSchemaFactory.getInstance(prefixItems[i]) + val otherPathToSchemas = JsonSchema.validate(itemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs new file mode 100644 index 00000000000..853a520a5c6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertiesValidator.hbs @@ -0,0 +1,44 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class PropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val properties: Map>> = data.schema.properties ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val presentProperties: MutableSet = LinkedHashSet() + for (key in data.arg.keys) { + if (key is String) { + presentProperties.add(key) + } + } + for ((propName, propClass) in properties.entries) { + if (!presentProperties.contains(propName)) { + continue + } + val propValue: Any? = data.arg[propName] + val propPathToItem: MutableList = ArrayList(data.validationMetadata.pathToItem) + propPathToItem.add(propName) + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val propSchema = JsonSchemaFactory.getInstance(propClass) + if (propValidationMetadata.validationRanEarlier(propSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(propSchema, propValue, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs new file mode 100644 index 00000000000..e7067a3c2c5 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/PropertyNamesValidator.hbs @@ -0,0 +1,29 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class PropertyNamesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val propertyNames: Class> = data.schema.propertyNames ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val propertyNamesSchema = JsonSchemaFactory.getInstance(propertyNames) + for (objKey in data.arg.keys) { + if (objKey is String) { + val propPathToItem: List = data.validationMetadata.pathToItem + objKey + val keyValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + JsonSchema.validate(propertyNamesSchema, objKey, keyValidationMetadata) + } + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs new file mode 100644 index 00000000000..c7c6f26a447 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/RequiredValidator.hbs @@ -0,0 +1,32 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class RequiredValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val required: Set = data.schema.required ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val missingRequiredProperties: MutableSet = HashSet(required) + for (key in data.arg.keys) { + if (key is String) { + missingRequiredProperties.remove(key) + } + } + if (missingRequiredProperties.isNotEmpty()) { + val missingReqProps: List = missingRequiredProperties.toList().sorted() + var pluralChar = "" + if (missingRequiredProperties.size > 1) { + pluralChar = "s" + } + throw ValidationException( + data.schema.javaClass.simpleName + " is missing " + missingRequiredProperties.size + " required argument" + pluralChar + ": " + missingReqProps + ) + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs new file mode 100644 index 00000000000..087da44dd8c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringEnumValidator.hbs @@ -0,0 +1,9 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface StringEnumValidator { + @Throws(ValidationException::class) + fun validate(arg: EnumType, configuration: SchemaConfiguration?): String +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs new file mode 100644 index 00000000000..62f02ecb688 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringSchemaValidator.hbs @@ -0,0 +1,12 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +interface StringSchemaValidator { + @Throws(ValidationException::class) + fun validate(arg: String, configuration: SchemaConfiguration?): String + + @Throws(ValidationException::class) + fun validateAndBox(arg: String, configuration: SchemaConfiguration?): T +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs new file mode 100644 index 00000000000..15e97bbf4a8 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/StringValueMethod.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.schemas.validation + +interface StringValueMethod { + fun value(): String +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs new file mode 100644 index 00000000000..7905ae2c727 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ThenValidator.hbs @@ -0,0 +1,26 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class ThenValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val then: Class> = data.schema.then ?: return null + val ifPathToSchemas: PathToSchemasMap = data.ifPathToSchemas + ?: // if unset + return null + if (ifPathToSchemas.isEmpty()) { + // if validation is false + return null + } + val thenSchema = JsonSchemaFactory.getInstance(then) + val pathToSchemas = PathToSchemasMap() + val thenPathToSchemas = JsonSchema.validate(thenSchema, data.arg, data.validationMetadata) + // todo capture validation error and describe it as an then error? + pathToSchemas.update(ifPathToSchemas) + pathToSchemas.update(thenPathToSchemas) + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs new file mode 100644 index 00000000000..e99dfba4c9e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/TypeValidator.hbs @@ -0,0 +1,51 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class TypeValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + if (data.schema.type == null) { + return null + } + val argClass = when (data.arg) { + null -> { + Void::class.java + } + is List<*> -> { + List::class.java + } + + is Map<*, *> -> { + Map::class.java + } + + is Boolean -> { + Boolean::class.java + } + + is Int -> { + Int::class.java + } + is Long -> { + Long::class.java + } + is Double -> { + Double::class.java + } + is Float -> { + Float::class.java + } + + else -> { + data.arg.javaClass + } + } + if (!data.schema.type.contains(argClass)) { + throw ValidationException("invalid type") + } + return null + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs new file mode 100644 index 00000000000..de9a8e86f83 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedItemsValidator.hbs @@ -0,0 +1,41 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class UnevaluatedItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedItems: Class> = data.schema.unevaluatedItems ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is List<*>) { + return null + } + if (data.arg.isEmpty()) { + return null + } + val pathToSchemas = PathToSchemasMap() + val minIndex = if (data.schema.prefixItems != null) data.schema.prefixItems.size else 0 + val unevaluatedItemsSchema = JsonSchemaFactory.getInstance(unevaluatedItems) + for (i in minIndex until data.arg.size) { + val itemPathToItem: List = data.validationMetadata.pathToItem + i + if (knownPathToSchemas.containsKey(itemPathToItem)) { + continue + } + val itemValidationMetadata = ValidationMetadata( + itemPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + if (itemValidationMetadata.validationRanEarlier(unevaluatedItemsSchema)) { + // todo add_deeper_validated_schemas + continue + } + val otherPathToSchemas = JsonSchema.validate(unevaluatedItemsSchema, data.arg[i], itemValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs new file mode 100644 index 00000000000..6faab40d772 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnevaluatedPropertiesValidator.hbs @@ -0,0 +1,36 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class UnevaluatedPropertiesValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val unevaluatedProperties: Class> = data.schema.unevaluatedProperties ?: return null + val knownPathToSchemas: PathToSchemasMap = data.knownPathToSchemas ?: return null + if (data.arg !is Map<*, *>) { + return null + } + val pathToSchemas = PathToSchemasMap() + val unevaluatedPropertiesSchema = JsonSchemaFactory.getInstance(unevaluatedProperties) + for ((key, value) in data.arg.entries) { + if (key !is String) { + throw ValidationException("Map keys must be strings") + } + val propPathToItem: List = data.validationMetadata.pathToItem + key + if (knownPathToSchemas.containsKey(propPathToItem)) { + continue + } + val propValidationMetadata = ValidationMetadata( + propPathToItem, + data.validationMetadata.configuration, + data.validationMetadata.validatedPathToSchemas, + data.validationMetadata.seenClasses + ) + val otherPathToSchemas = JsonSchema.validate(unevaluatedPropertiesSchema, value, propValidationMetadata) + pathToSchemas.update(otherPathToSchemas) + } + return pathToSchemas + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs new file mode 100644 index 00000000000..2821d52a273 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UniqueItemsValidator.hbs @@ -0,0 +1,27 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.exceptions.ValidationException + +class UniqueItemsValidator : KeywordValidator { + @Throws(ValidationException::class) + override fun validate( + data: ValidationData + ): PathToSchemasMap? { + val uniqueItems: Boolean = data.schema.uniqueItems ?: return null + if (data.arg !is List<*>) { + return null + } + if (!uniqueItems) { + return null + } + val seenItems: MutableSet = HashSet() + for (item in data.arg) { + val startingSeenItemsSize = seenItems.size + seenItems.add(item) + if (seenItems.size == startingSeenItemsSize) { + throw ValidationException("Invalid list value, list contains duplicate items when uniqueItems is true") + } + } + return null + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs new file mode 100644 index 00000000000..a7729c5cf29 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/UnsetAnyTypeJsonSchema.hbs @@ -0,0 +1,336 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +import java.time.LocalDate +import java.time.ZonedDateTime +import java.util.UUID + +class UnsetAnyTypeJsonSchema { + sealed interface UnsetAnyTypeJsonSchema1Boxed { + fun getData(): Any? + } + + data class UnsetAnyTypeJsonSchema1BoxedVoid(val data: Nothing?) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedBoolean(val data: Boolean) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedNumber(val data: Number) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedString(val data: String) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedList(val data: FrozenList) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + data class UnsetAnyTypeJsonSchema1BoxedMap(val data: FrozenMap) : UnsetAnyTypeJsonSchema1Boxed { + override fun getData(): Any? { + return data + } + } + + class UnsetAnyTypeJsonSchema1 private constructor() : JsonSchema(JsonSchemaInfo()), + NullSchemaValidator, + BooleanSchemaValidator, + NumberSchemaValidator, + StringSchemaValidator, + ListSchemaValidator, UnsetAnyTypeJsonSchema1BoxedList>, + MapSchemaValidator, UnsetAnyTypeJsonSchema1BoxedMap> { + @Throws(ValidationException::class) + override fun validate(arg: Nothing?, configuration: SchemaConfiguration?): Nothing? { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Nothing? = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Boolean, configuration: SchemaConfiguration?): Boolean { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Boolean = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validate(arg: Number, configuration: SchemaConfiguration?): Number { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Number = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: Int, configuration: SchemaConfiguration?): Int { + return validate(arg as Number, configuration) as Int + } + + @Throws(ValidationException::class) + fun validate(arg: Long, configuration: SchemaConfiguration?): Long { + return validate(arg as Number, configuration) as Long + } + + @Throws(ValidationException::class) + fun validate(arg: Float, configuration: SchemaConfiguration?): Float { + return validate(arg as Number, configuration) as Float + } + + @Throws(ValidationException::class) + fun validate(arg: Double, configuration: SchemaConfiguration?): Double { + return validate(arg as Number, configuration) as Double + } + + @Throws(ValidationException::class) + override fun validate(arg: String, configuration: SchemaConfiguration?): String { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: String = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + fun validate(arg: LocalDate, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: ZonedDateTime, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + @Throws(ValidationException::class) + fun validate(arg: UUID, configuration: SchemaConfiguration?): String { + return validate(arg.toString(), configuration) + } + + override fun getNewInstance(arg: List<*>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Map<*, *>, pathToItem: List, pathToSchemas: PathToSchemasMap): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0]") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validatedPathToSchemas = PathToSchemasMap() + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, validatedPathToSchemas, LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + when (arg) { + null -> { + return getNewInstance(null, pathToItem, pathToSchemas) + } + is Boolean -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Number -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is String -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is List<*> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + is Map<*, *> -> { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + + else -> throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + when (arg) { + null -> { + return validate(null, configuration) + } + is Boolean -> { + return validate(arg, configuration) + } + + is Number -> { + return validate(arg, configuration) + } + + is String -> { + return validate(arg, configuration) + } + + is List<*> -> { + return validate(arg, configuration) + } + + is Map<*, *> -> { + return validate(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Nothing?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedVoid { + return UnsetAnyTypeJsonSchema1BoxedVoid(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Boolean, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedBoolean { + return UnsetAnyTypeJsonSchema1BoxedBoolean(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Number, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedNumber { + return UnsetAnyTypeJsonSchema1BoxedNumber(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: String, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedString { + return UnsetAnyTypeJsonSchema1BoxedString(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedList { + return UnsetAnyTypeJsonSchema1BoxedList(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Map<*, *>, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1BoxedMap { + return UnsetAnyTypeJsonSchema1BoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): UnsetAnyTypeJsonSchema1Boxed { + when (arg) { + null -> { + return validateAndBox(null, configuration) + } + is Boolean -> { + val castArg: Boolean = arg + return validateAndBox(castArg, configuration) + } + + is String -> { + return validateAndBox(arg, configuration) + } + + is Number -> { + return validateAndBox(arg, configuration) + } + + is List<*> -> { + return validateAndBox(arg, configuration) + } + + is Map<*, *> -> { + return validateAndBox(arg, configuration) + } + + else -> throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + companion object { + @Volatile + private var instance: UnsetAnyTypeJsonSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: UnsetAnyTypeJsonSchema1().also { instance = it } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs new file mode 100644 index 00000000000..9509c2ac0d1 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationData.hbs @@ -0,0 +1,11 @@ +package {{{packageName}}}.schemas.validation + +data class ValidationData( + val schema: JsonSchema<*>, + val arg: Any?, + val validationMetadata: ValidationMetadata, + val containsPathToSchemas: List? = null, + val patternPropertiesPathToSchemas: PathToSchemasMap? = null, + val ifPathToSchemas: PathToSchemasMap? = null, + val knownPathToSchemas: PathToSchemasMap? = null +) \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs new file mode 100644 index 00000000000..70ce12ee9b6 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/schemas/validation/ValidationMetadata.hbs @@ -0,0 +1,18 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.SchemaConfiguration + +data class ValidationMetadata( + val pathToItem: List, + val configuration: SchemaConfiguration, + val validatedPathToSchemas: PathToSchemasMap, + val seenClasses: Set> +) { + fun validationRanEarlier(schema: JsonSchema<*>): Boolean { + val validatedSchemas: Map, Nothing?>? = validatedPathToSchemas[pathToItem] + if (validatedSchemas != null && validatedSchemas.containsKey(schema)) { + return true + } + return seenClasses.contains(schema.javaClass) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs new file mode 100644 index 00000000000..30d74eff680 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/AuthApplier.hbs @@ -0,0 +1,40 @@ +package {{{packageName}}}.securityrequirementobjects; + +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.securityschemes.SecurityScheme; +import {{{packageName}}}.configurations.ApiConfiguration; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class AuthApplier { + protected static void updateParamsForAuth( + @Nullable SecurityRequirementObject securityRequirementObject, + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + ApiConfiguration apiConfiguration + ) { + if (securityRequirementObject == null) { + return; + } + // TODO change securityRequirementObject to be a map of enum to scopes + // TODO store the SecurityScheme instances in a map in apiConfiguration + for (Map.Entry, List> entry: securityRequirementObject.securitySchemeToScopes.entrySet()) { + Class securitySchemeClass = entry.getKey(); + SecurityScheme securityScheme = apiConfiguration.getSecurityScheme(securitySchemeClass); + List scopeNames = entry.getValue(); + securityScheme.applyAuth( + headers, + resourcePath, + method, + bodyPublisher, + queryMap, + scopeNames + ); + } + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs new file mode 100644 index 00000000000..e94e7b2b3f4 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/EmptySecurityRequirementObject.hbs @@ -0,0 +1,10 @@ +package {{{packageName}}}.securityrequirementobjects; + +import java.util.Map; + +public class EmptySecurityRequirementObject extends SecurityRequirementObject { + + public EmptySecurityRequirementObject() { + super(Map.of()); + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs new file mode 100644 index 00000000000..899e05dee32 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfo.hbs @@ -0,0 +1,50 @@ +{{#if security.subpackage}} +package {{{packageName}}}.{{security.subpackage}}; +{{else}} +package {{{packageName}}}; +{{/if}} + +{{#each security}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}}; +{{/each}} +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObject; +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObjectProvider; + +public class {{security.jsonPathPiece.pascalCase}} { + public static class {{security.jsonPathPiece.pascalCase}}1 implements SecurityRequirementObjectProvider { +{{#each security}} + public final {{jsonPathPiece.pascalCase}} security{{@index}}; +{{/each}} + + public {{security.jsonPathPiece.pascalCase}}1() { +{{#each security}} + security{{@index}} = new {{jsonPathPiece.pascalCase}}(); +{{/each}} + } + + @Override + public SecurityRequirementObject getSecurityRequirementObject(SecurityIndex securityIndex) { + {{#eq security.size 1}} + return security0; + {{else}} + switch (securityIndex) { + {{#each security}} + {{#if @last}} + default: + return security{{@index}}; + {{else}} + case SECURITY_{{@index}}: + return security{{@index}}; + {{/if}} + {{/each}} + } + {{/eq}} + } + } + + public enum SecurityIndex { + {{#each security}} + SECURITY_{{@index}}{{#unless @last}},{{/unless}} + {{/each}} + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs new file mode 100644 index 00000000000..550d8f53493 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityInfoDoc.hbs @@ -0,0 +1,44 @@ +{{headerSize}} {{security.jsonPathPiece.pascalCase}} +{{security.jsonPathPiece.pascalCase}}.java + +public class {{security.jsonPathPiece.pascalCase}} + +A class that provides a security requirement object, and any needed security info classes +- a class that is a SecurityRequirementObjectProvider +- an enum class that describes security index values + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{security.jsonPathPiece.pascalCase}}.{{security.jsonPathPiece.pascalCase}}1](#{{security.jsonPathPiece.kebabCase}}1)
SecurityRequirementObjectProvider +| enum | [{{security.jsonPathPiece.pascalCase}}.SecurityIndex](#securityindex)
class that stores a security index | + +{{headerSize}}# {{security.jsonPathPiece.pascalCase}}1 +implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)> + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{security.jsonPathPiece.pascalCase}}1()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +{{#each security}} +| [{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) | security{{@index}} | +{{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)
If null is input, then the instance's securityIndex will be used | + +{{headerSize}}# SecurityIndex +enum SecurityIndex
+ +{{headerSize}}## Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +{{#each security}} +| SECURITY_{{@index}}
security {{@index}} | +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs new file mode 100644 index 00000000000..30eaf6f265d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObject.hbs @@ -0,0 +1,14 @@ +package {{{packageName}}}.securityrequirementobjects; + +import {{{packageName}}}.securityschemes.SecurityScheme; + +import java.util.List; +import java.util.Map; + +public class SecurityRequirementObject { + public final Map, List> securitySchemeToScopes; + + public SecurityRequirementObject(Map, List> securitySchemeToScopes) { + this.securitySchemeToScopes = securitySchemeToScopes; + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs new file mode 100644 index 00000000000..87cab40e36b --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectN.hbs @@ -0,0 +1,34 @@ +package {{{packageName}}}.{{securityRequirementObject.subpackage}}; + +{{#if securityRequirementObject.isEmpty }} +import {{{packageName}}}.securityrequirementobjects.EmptySecurityRequirementObject; + +public class {{securityRequirementObject.jsonPathPiece.pascalCase}} extends EmptySecurityRequirementObject {} +{{else}} +import org.checkerframework.checker.nullness.qual.Nullable; +import {{{packageName}}}.securityrequirementobjects.SecurityRequirementObject; +import {{{packageName}}}.securityschemes.SecurityScheme; + {{#with securityRequirementObject}} +{{> _helper_imports }} + {{/with}} + +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; + +public class {{securityRequirementObject.jsonPathPiece.pascalCase}} extends SecurityRequirementObject { + + public {{securityRequirementObject.jsonPathPiece.pascalCase}}() { + super( + Map.ofEntries( + {{#each securityRequirementObject}} + new AbstractMap.SimpleEntry, List>( + {{refInfo.refClass}}.class, + List.of({{#each scopeNames}}"{{.}}"{{#unless @last}}, {{/unless}}{{/each}}) + ){{#unless @last}},{{/unless}} + {{/each}} + ) + ); + } +} +{{/if}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs new file mode 100644 index 00000000000..d87ec25d5dd --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectNDoc.hbs @@ -0,0 +1,19 @@ +{{headerSize}} {{securityRequirementObject.jsonPathPiece.pascalCase}} +{{securityRequirementObject.jsonPathPiece.pascalCase}}.java + +public class {{securityRequirementObject.jsonPathPiece.pascalCase}} +{{#if securityRequirementObject.isEmpty }} +extends EmptySecurityRequirementObject +{{else}} +extends SecurityRequirementObject +{{/if}} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{securityRequirementObject.jsonPathPiece.pascalCase}}()
Creates an instance | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| Map, List> | securitySchemeToScopes = Map.ofEntries({{#each securityRequirementObject}}
    new AbstractMap.SimpleEntry, List>(
        [{{refInfo.refClass}}.class]({{docRoot}}{{refInfo.ref.pathFromDocRoot}}.md),
        List.of({{#each scopeNames}}"{{.}}"{{#unless @last}}, {{/unless}}{{/each}})
    ){{#unless @last}},{{/unless}}{{/each}}) | diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs new file mode 100644 index 00000000000..57c32dfbf6a --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/SecurityRequirementObjectProvider.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.securityrequirementobjects; + +public interface SecurityRequirementObjectProvider { + SecurityRequirementObject getSecurityRequirementObject(T securityIndex); +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/_SecurityRequirementObjectSetter.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/_SecurityRequirementObjectSetter.hbs new file mode 100644 index 00000000000..6c9385388df --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityrequirementobjects/_SecurityRequirementObjectSetter.hbs @@ -0,0 +1,5 @@ +default T {{methodName}}({{jsonPathPiece.pascalCase}} security{{@index}}) { + var instance = getInstance(); + instance.put(SecurityIndex.SECURITY_{{@index}}, security{{@index}}); + return {{getBuilderMethod}}(instance); +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs new file mode 100644 index 00000000000..f4e62169e7d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyCookieSecurityScheme.hbs @@ -0,0 +1,35 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyCookieSecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyCookieSecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List cookieHeaderValues = headers.getOrDefault("Cookie", new ArrayList<>()); + String cookieValue = name + "=" + apiKey; + if (cookieHeaderValues.isEmpty()) { + cookieHeaderValues.add(cookieValue); + } else { + cookieHeaderValues.set(0, cookieHeaderValues.get(0)+ "; " + cookieValue); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs new file mode 100644 index 00000000000..1f89a830e84 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyHeaderSecurityScheme.hbs @@ -0,0 +1,31 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyHeaderSecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyHeaderSecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List headerValue = headers.getOrDefault(name, new ArrayList<>()); + headerValue.add(apiKey); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs new file mode 100644 index 00000000000..5974935be7d --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/ApiKeyQuerySecurityScheme.hbs @@ -0,0 +1,33 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ApiKeyQuerySecurityScheme implements SecurityScheme { + private final String apiKey; + private final String name; + + protected ApiKeyQuerySecurityScheme(String apiKey, String name) { + this.apiKey = apiKey; + this.name = name; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + if (queryMap == null) { + throw new RuntimeException("Invalid null value for queryMap"); + } + queryMap.put(name, apiKey); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs new file mode 100644 index 00000000000..02230c35f8e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBasicSecurityScheme.hbs @@ -0,0 +1,39 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; + +public class HttpBasicSecurityScheme implements SecurityScheme { + private final String userId; + private final String password; + /* + scheme = BASIC, type = HTTP + https://www.rfc-editor.org/rfc/rfc7617.html + */ + + public HttpBasicSecurityScheme(String userId, String password) { + this.userId = userId; + this.password = password; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + String userPass = userId + ":" + password; + String b64UserPass = Base64.getEncoder().encodeToString(userPass.getBytes(StandardCharsets.UTF_8)); + List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); + headerValue.add("Basic " + b64UserPass); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs new file mode 100644 index 00000000000..ccf3c63732f --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpBearerSecurityScheme.hbs @@ -0,0 +1,41 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; + +public class HttpBearerSecurityScheme implements SecurityScheme { + private final String accessToken; + private final @Nullable String bearerFormat; + /* + scheme = BEARER, type = HTTP + https://www.rfc-editor.org/rfc/rfc7617.html + */ + + protected HttpBearerSecurityScheme(String accessToken, @Nullable String bearerFormat) { + this.accessToken = accessToken; + this.bearerFormat = bearerFormat; + } + + protected HttpBearerSecurityScheme(String accessToken) { + this.accessToken = accessToken; + this.bearerFormat = null; + } + + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + List headerValue = headers.getOrDefault("Authorization", new ArrayList<>()); + headerValue.add("Bearer " + accessToken); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs new file mode 100644 index 00000000000..9b12d7b199c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpDigestSecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class HttpDigestSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs new file mode 100644 index 00000000000..b9529f505fe --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/HttpSignatureSecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class HttpSignatureSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs new file mode 100644 index 00000000000..4afad17948e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/MutualTlsSecurityScheme.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class MutualTlsSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs new file mode 100644 index 00000000000..8d42bb1a30c --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OAuth2SecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class OAuth2SecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs new file mode 100644 index 00000000000..a973fb94d46 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/OpenIdConnectSecurityScheme.hbs @@ -0,0 +1,21 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public class OpenIdConnectSecurityScheme implements SecurityScheme { + @Override + public void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ) { + throw new UnsupportedOperationException("If you need this, submit a PR adding this feature"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs new file mode 100644 index 00000000000..f058bf0f226 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/securityschemes/SecurityScheme.hbs @@ -0,0 +1,19 @@ +package {{{packageName}}}.securityschemes; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.net.http.HttpRequest; +import java.util.List; +import java.util.Map; + +public interface SecurityScheme { + void applyAuth( + Map> headers, + String resourcePath, + String method, + HttpRequest.BodyPublisher bodyPublisher, + @Nullable Map queryMap, + List scopeNames + ); +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs new file mode 100644 index 00000000000..166458cf104 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/Server.hbs @@ -0,0 +1,5 @@ +package {{{packageName}}}.servers; + +interface Server { + fun url(): String +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerDoc.hbs new file mode 100644 index 00000000000..36c9194f8c0 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerDoc.hbs @@ -0,0 +1,45 @@ +{{#with server}} + {{#if rootServer}} +{{packageName}}.servers.{{jsonPathPiece.snakeCase}} + {{/if}} + {{#eq identifierPieces.size 0}} +{{> src/main/kotlin/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces "Server" jsonPathPiece) }} + {{else}} +{{headerSize}} {{jsonPathPiece.pascalCase}} + {{/eq}} +public class {{jsonPathPiece.pascalCase}} + +A class that stores a server url + {{#if description}} + +{{headerSize}}# Description +{{description.originalWithBr}} + {{/if}} + {{#if refInfo}} + +| Ref Class | Description | +| --------- | ----------- | +| [{{refInfo.refClass}}](../../servers/{{refInfo.refModule}}.{{refInfo.refClass}}.md#) |{{#with getDeepestRef}}{{#if description}} {{description.originalWithBr}}{{/if}}{{/with}} | + {{else}} + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{jsonPathPiece.pascalCase}}()
Creates a server{{#if variables}} using default values for variables{{/if}} | +{{#if variables}} +| {{jsonPathPiece.pascalCase}}({{#with variables}}[{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) variables{{/with}})
Creates a server using input values for variables | +{{/if}} + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +| String | url = "{{{url}}}" | +{{#with variables}} +| [{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md#{{mapOutputJsonPathPiece.kebabCase}}) | variables | +{{/with}} + {{/if}} + {{#if rootServer}} + +[[Back to top]](#top) {{> _helper_footer_links readmePath="../../" serversLink=true}} + {{/if}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs new file mode 100644 index 00000000000..372cc59730e --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfo.hbs @@ -0,0 +1,44 @@ +{{#if servers.subpackage}} +package {{{packageName}}}.{{servers.subpackage}} +{{else}} +package {{{packageName}}} +{{/if}} + +{{#each servers}} +import {{{packageName}}}.{{subpackage}}.{{jsonPathPiece.pascalCase}} +{{/each}} +import {{{packageName}}}.servers.Server +import {{{packageName}}}.servers.ServerProvider + +class {{servers.jsonPathPiece.pascalCase}} { + class {{servers.jsonPathPiece.pascalCase}}1( + {{#each servers}} + private val server{{@index}}: {{jsonPathPiece.pascalCase}} = {{jsonPathPiece.pascalCase}}(){{#unless @last}},{{/unless}} + {{/each}} + ) : ServerProvider { + + override fun getServer(serverIndex: ServerIndex): Server { + {{#eq servers.size 1}} + return server0 + {{else}} + switch (serverIndex) { + {{#each servers}} + {{#if @last}} + default: + return server{{@index}}; + {{else}} + case SERVER_{{@index}}: + return server{{@index}}; + {{/if}} + {{/each}} + } + {{/eq}} + } + } + + enum class ServerIndex { + {{#each servers}} + SERVER_{{@index}}{{#unless @last}},{{/unless}} + {{/each}} + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfoDoc.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfoDoc.hbs new file mode 100644 index 00000000000..b792f715dfb --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerInfoDoc.hbs @@ -0,0 +1,65 @@ +{{headerSize}} {{servers.jsonPathPiece.pascalCase}} +{{servers.jsonPathPiece.pascalCase}}.java + +public class {{servers.jsonPathPiece.pascalCase}} + +A class that provides a server, and any needed server info classes +- a class that is a ServerProvider +- a builder for the ServerProvider +- an enum class that stores server index values + +{{headerSize}}# Nested Class Summary +| Modifier and Type | Class and Description | +| ----------------- | --------------------- | +| static class | [{{servers.jsonPathPiece.pascalCase}}.{{servers.jsonPathPiece.pascalCase}}1](#{{servers.jsonPathPiece.kebabCase}}1)
class that stores a server index | +| static class | [{{servers.jsonPathPiece.pascalCase}}.{{servers.jsonPathPiece.pascalCase}}Builder](#{{servers.jsonPathPiece.kebabCase}}builder)
class that stores a server index | +| enum | [{{servers.jsonPathPiece.pascalCase}}.ServerIndex](#serverindex)
class that stores a server index | + +{{headerSize}}# {{servers.jsonPathPiece.pascalCase}}1 +implements ServerProvider<[ServerIndex](#serverindex)>
+ +A class that stores servers and allows one to be returned with a ServerIndex instance + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{servers.jsonPathPiece.pascalCase}}1({{#each servers}}@Nullable [{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) server{{@index}}{{#unless @last}},{{/unless}}{{/each}})
Creates an instance using passed in servers | + +{{headerSize}}## Field Summary +| Modifier and Type | Field and Description | +| ----------------- | --------------------- | +{{#each servers}} +| [{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) | server{{@index}} | +{{/each}} + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +| Server | getServer([ServerIndex](#serverindex) serverIndex) | + +{{headerSize}}# {{servers.jsonPathPiece.pascalCase}}Builder + +a builder for [{{servers.jsonPathPiece.pascalCase}}1](#{{servers.jsonPathPiece.kebabCase}}1) + +{{headerSize}}## Constructor Summary +| Constructor and Description | +| --------------------------- | +| {{servers.jsonPathPiece.pascalCase}}Builder()
Creates an instance | + +{{headerSize}}## Method Summary +| Modifier and Type | Method and Description | +| ----------------- | ---------------------- | +{{#each servers}} +| [{{servers.jsonPathPiece.pascalCase}}Builder](#{{servers.jsonPathPiece.kebabCase}}builder) | {{jsonPathPiece.camelCase}}([{{jsonPathPiece.pascalCase}}]({{docRoot}}{{pathFromDocRoot}}.md) server{{@index}})
sets the server | +{{/each}} +| [{{servers.jsonPathPiece.pascalCase}}1](#{{servers.jsonPathPiece.kebabCase}}1) | build() | + +{{headerSize}}# ServerIndex +enum ServerIndex
+ +{{headerSize}}## Enum Constant Summary +| Enum Constant And Description | +| ----------------------------- | +{{#each servers}} +| SERVER_{{@index}}
server {{@index}} | +{{/each}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs new file mode 100644 index 00000000000..bf643cba542 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerN.hbs @@ -0,0 +1,60 @@ +{{#with server}} +package {{{packageName}}}.{{subpackage}}; + + {{#with variables}} +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; + {{#neq ../subpackage "servers"}} +import {{{packageName}}}.servers.ServerWithVariables; + {{/neq}} +import {{{packageName}}}.schemas.validation.MapUtils; +import {{{packageName}}}.{{subpackage}}.{{containerJsonPathPiece.pascalCase}}; + +import java.util.AbstractMap; + +class {{../jsonPathPiece.pascalCase}} : ServerWithVariables<{{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}}> { + {{#if ../description}} + /* + {{../description.original}} + */ + {{/if}} + private static {{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}} getVariables() { + try { + return {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance().validate( + MapUtils.makeMap( + {{#each requiredProperties}} + new AbstractMap.SimpleEntry<>("{{{@key.original}}}", {{../containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance().defaultValue()){{#unless @last}},{{/unless}} + {{/each}} + ), + new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()) + ); + } catch (ValidationException e) { + throw new RuntimeException(e); + } + } + + public {{../jsonPathPiece.pascalCase}}() { + super( + "{{../url}}", + getVariables() + ); + } + public {{../jsonPathPiece.pascalCase}}({{containerJsonPathPiece.pascalCase}}.{{mapOutputJsonPathPiece.pascalCase}} variables) { + super("{{../url}}", variables); + } +} + {{else}} + {{#neq ../subpackage "servers"}} +import {{{packageName}}}.servers.ServerWithoutVariables; + {{/neq}} + +class {{jsonPathPiece.pascalCase}} : ServerWithoutVariables("{{url}}") { + {{#if ../description}} + /* + {{../description.original}} + */ + {{/if}} +} + {{/with}} +{{/with}} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs new file mode 100644 index 00000000000..3777b296e48 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerProvider.hbs @@ -0,0 +1,6 @@ +package {{{packageName}}}.servers; + +interface ServerProvider { + fun getServer(serverIndex: T): Server +} + diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs new file mode 100644 index 00000000000..1aeef2aff50 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithVariables.hbs @@ -0,0 +1,20 @@ +package {{{packageName}}}.servers + +abstract class ServerWithVariables> protected constructor(url: String, variables: T) : + Server { + val url: String + val variables: T + + init { + var url = url + this.variables = variables + for ((key, value) in variables) { + url = url.replace("{$key}", value) + } + this.url = url + } + + override fun url(): String { + return url + } +} diff --git a/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs new file mode 100644 index 00000000000..963fb222752 --- /dev/null +++ b/src/main/resources/kotlin/src/main/kotlin/packagename/servers/ServerWithoutVariables.hbs @@ -0,0 +1,8 @@ +package {{{packageName}}}.servers; + +abstract class ServerWithoutVariables protected constructor(val url: String) : Server { + override fun url(): String { + return url + } +} + diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs new file mode 100644 index 00000000000..69bcfdafe93 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/components/schemas/Schema_test.hbs @@ -0,0 +1,51 @@ +package {{{packageName}}}.components.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith + +{{#with schema}} +class {{containerJsonPathPiece.pascalCase}}Test { + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().format().build()) + } +{{#each testCases}} + {{#with this }} + + @Test + fun test{{@key}}{{#if valid}}Passes(){{else}}Fails(){{/if}} { + // {{description.codeEscaped}} + val schema = {{containerJsonPathPiece.pascalCase}}.{{jsonPathPiece.pascalCase}}.getInstance() + {{#if valid}} + schema.validate( + {{#with data}} + {{#and (eq type "array") ../arrayInputJsonPathPiece }} + {{../containerJsonPathPiece.pascalCase}}.{{../arrayInputJsonPathPiece.pascalCase}}() + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer constructor=true endChar="" }} + .build(), + {{else}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/and}} + {{/with}} + configuration + ) + {{else}} + assertFailsWith( + block = { + schema.validate( + {{#with data}} + {{> src/main/kotlin/packagename/components/schemas/helpers/payload_renderer endChar="," }} + {{/with}} + configuration + ) + } + ) + {{/if}} + } + {{/with}} +{{/each}} +{{/with}} +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs new file mode 100644 index 00000000000..6aacfec5379 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/configurations/JsonSchemaKeywordFlagsTest.hbs @@ -0,0 +1,141 @@ +package {{{packageName}}}.configurations; + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaKeywordFlagsTest { + @Test + fun testGetEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + expectedEnabledKeywords.add("additionalProperties") + expectedEnabledKeywords.add("allOf") + expectedEnabledKeywords.add("anyOf") + expectedEnabledKeywords.add("const") + expectedEnabledKeywords.add("contains") + expectedEnabledKeywords.add("dependentRequired") + expectedEnabledKeywords.add("dependentSchemas") + expectedEnabledKeywords.add("discriminator") + expectedEnabledKeywords.add("else_") + expectedEnabledKeywords.add("enum_") + expectedEnabledKeywords.add("exclusiveMaximum") + expectedEnabledKeywords.add("exclusiveMinimum") + expectedEnabledKeywords.add("format") + expectedEnabledKeywords.add("if_") + expectedEnabledKeywords.add("maximum") + expectedEnabledKeywords.add("minimum") + expectedEnabledKeywords.add("items") + expectedEnabledKeywords.add("maxContains") + expectedEnabledKeywords.add("maxItems") + expectedEnabledKeywords.add("maxLength") + expectedEnabledKeywords.add("maxProperties") + expectedEnabledKeywords.add("minContains") + expectedEnabledKeywords.add("minItems") + expectedEnabledKeywords.add("minLength") + expectedEnabledKeywords.add("minProperties") + expectedEnabledKeywords.add("multipleOf") + expectedEnabledKeywords.add("not") + expectedEnabledKeywords.add("oneOf") + expectedEnabledKeywords.add("pattern") + expectedEnabledKeywords.add("patternProperties") + expectedEnabledKeywords.add("prefixItems") + expectedEnabledKeywords.add("properties") + expectedEnabledKeywords.add("propertyNames") + expectedEnabledKeywords.add("required") + expectedEnabledKeywords.add("then") + expectedEnabledKeywords.add("type") + expectedEnabledKeywords.add("uniqueItems") + expectedEnabledKeywords.add("unevaluatedItems") + expectedEnabledKeywords.add("unevaluatedProperties") + assertEquals(enabledKeywords, expectedEnabledKeywords) + } + + @Test + fun testGetNoEnabledKeywords() { + val jsonSchemaKeywordFlags = JsonSchemaKeywordFlags( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ) + val enabledKeywords = jsonSchemaKeywordFlags.keywords + val expectedEnabledKeywords = LinkedHashSet() + assertEquals(enabledKeywords, expectedEnabledKeywords) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/header/ContentHeaderTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/header/ContentHeaderTest.hbs new file mode 100644 index 00000000000..c6e8a86263a --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/header/ContentHeaderTest.hbs @@ -0,0 +1,120 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.mediatype.MediaType; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.net.http.HttpHeaders; +import java.util.AbstractMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.BiPredicate; + +public class ContentHeaderTest { + public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + @Test + public void testSerialization() throws ValidationException, NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + Map.of("color", List.of("null")) + ), + new ParamTestCase( + true, + Map.of("color", List.of("true")) + ), + new ParamTestCase( + false, + Map.of("color", List.of("false")) + ), + new ParamTestCase( + 1, + Map.of("color", List.of("1")) + ), + new ParamTestCase( + 3.14, + Map.of("color",List.of("3.14")) + ), + new ParamTestCase( + "blue", + Map.of("color", List.of("\"blue\"")) + ), + new ParamTestCase( + "hello world", + Map.of("color", List.of("\"hello world\"")) + ), + new ParamTestCase( + "", + Map.of("color", List.of("\"\"")) + ), + new ParamTestCase( + List.of(), + Map.of("color", List.of("[]")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("[\"blue\",\"black\",\"brown\"]")), + true + ), + new ParamTestCase( + Map.of(), + Map.of("color", List.of("{}")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("{\"R\":100,\"G\":200,\"B\":150}")), + true + ) + ); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + BiPredicate headerFilter = (key, val) -> true; + class ApplicationJsonMediaType implements MediaType { + @Override + public AnyTypeJsonSchema.AnyTypeJsonSchema1 schema() { + return AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance(); + } + + @Override + public Nothing? encoding() { + return null; + } + } + AbstractMap.SimpleEntry> content = new AbstractMap.SimpleEntry<>( + "application/json", new ApplicationJsonMediaType() + ); + for (ParamTestCase testCase: testCases) { + var header = new ContentHeader( + true, + false, + testCase.explode, + content + ); + var serialization = header.serialize(testCase.payload, "color", false, configuration); + Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); + } + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/header/SchemaHeaderTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/header/SchemaHeaderTest.hbs new file mode 100644 index 00000000000..c0404ccc143 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/header/SchemaHeaderTest.hbs @@ -0,0 +1,177 @@ +package {{{packageName}}}.header; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; +import {{{packageName}}}.schemas.ListJsonSchema; +import {{{packageName}}}.schemas.NullJsonSchema; +import {{{packageName}}}.schemas.NumberJsonSchema; +import {{{packageName}}}.schemas.StringJsonSchema; +import {{{packageName}}}.schemas.validation.JsonSchema; + +import java.net.http.HttpHeaders; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiPredicate; + +public class SchemaHeaderTest { + public record ParamTestCase(@Nullable Object payload, Map> expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, Map> expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + @Test + public void testSerialization() throws ValidationException, NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + Map.of("color", List.of("")) + ), + new ParamTestCase( + 1, + Map.of("color", List.of("1")) + ), + new ParamTestCase( + 3.14, + Map.of("color",List.of("3.14")) + ), + new ParamTestCase( + "blue", + Map.of("color", List.of("blue")) + ), + new ParamTestCase( + "hello world", + Map.of("color", List.of("hello world")) + ), + new ParamTestCase( + "", + Map.of("color", List.of("")) + ), + new ParamTestCase( + List.of(), + Map.of("color", List.of("")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("blue,black,brown")) + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + Map.of("color", List.of("blue,black,brown")), + true + ), + new ParamTestCase( + Map.of(), + Map.of("color", List.of("")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("R,100,G,200,B,150")) + ), + new ParamTestCase( + mapPayload, + Map.of("color", List.of("R=100,G=200,B=150")), + true + ) + ); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + BiPredicate headerFilter = (key, val) -> true; + for (ParamTestCase testCase: testCases) { + var header = new SchemaHeader( + true, + false, + testCase.explode, + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + ); + var serialization = header.serialize(testCase.payload, "color", false, configuration); + Assert.assertEquals(HttpHeaders.of(testCase.expectedSerialization, headerFilter), serialization); + } + SchemaHeader boolHeader = new SchemaHeader( + true, + false, + false, + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + ); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> boolHeader.serialize(value, "color", false, configuration) + ); + } + } + + private static SchemaHeader getHeader(JsonSchema schema) { + return new SchemaHeader( + true, + false, + false, + schema + ); + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testDeserialization() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + + SchemaHeader header = getHeader(NullJsonSchema.NullJsonSchema1.getInstance()); + @Nullable Object deserialized = header.deserialize(List.of(""), false, configuration); + assertNull(deserialized); + + header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); + var deserializedOne = header.deserialize(List.of("1"), false, configuration); + if (deserializedOne == null) { + throw new RuntimeException("invalid value"); + } + @Nullable Object expected = 1L; + Assert.assertEquals(expected, deserializedOne); + + header = getHeader(NumberJsonSchema.NumberJsonSchema1.getInstance()); + var deserialized314 = header.deserialize(List.of("3.14"), false, configuration); + if (deserialized314 == null) { + throw new RuntimeException("invalid value"); + } + expected = 3.14d; + Assert.assertEquals(expected, deserialized314); + + header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); + var deserializedBlue = header.deserialize(List.of("blue"), false, configuration); + if (deserializedBlue == null) { + throw new RuntimeException("invalid value"); + } + expected = "blue"; + Assert.assertEquals(expected, deserializedBlue); + + header = getHeader(StringJsonSchema.StringJsonSchema1.getInstance()); + var deserializedHelloWorld = header.deserialize(List.of("hello world"), false, configuration); + if (deserializedHelloWorld == null) { + throw new RuntimeException("invalid value"); + } + expected = "hello world"; + Assert.assertEquals(expected, deserializedHelloWorld); + + header = getHeader(ListJsonSchema.ListJsonSchema1.getInstance()); + var deserializedList = header.deserialize(List.of("blue", "black", "brown"), false, configuration); + if (deserializedList == null) { + throw new RuntimeException("invalid value"); + } + expected = List.of("blue", "black", "brown"); + Assert.assertEquals(expected, deserializedList); + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs new file mode 100644 index 00000000000..fae1fcca373 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/CookieSerializerTest.hbs @@ -0,0 +1,45 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class CookieSerializerTest { + public static class Parameter1 extends SchemaParameter { + public Parameter1() { + super("param1", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Parameter2 extends SchemaParameter { + public Parameter2() { + super("param2", ParameterInType.COOKIE, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class CookieParametersSerializer extends CookieSerializer { + protected CookieParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Parameter1()), + new AbstractMap.SimpleEntry<>("param2", new Parameter2()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + String cookie = new CookieParametersSerializer().serialize(inData); + String expectedCookie = "param1=a; param2=3.14"; + Assert.assertEquals(expectedCookie, cookie); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs new file mode 100644 index 00000000000..6d3f5c2594c --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/HeadersSerializerTest.hbs @@ -0,0 +1,49 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; +import java.util.List; + +public class HeadersSerializerTest { + public static class Param1HeaderParameter extends SchemaParameter { + public Param1HeaderParameter() { + super("param1", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Param2HeaderParameter extends SchemaParameter { + public Param2HeaderParameter() { + super("param2", ParameterInType.HEADER, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class HeaderParametersSerializer extends HeadersSerializer { + protected HeaderParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Param1HeaderParameter()), + new AbstractMap.SimpleEntry<>("param2", new Param2HeaderParameter()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + Map> expectedHeaders = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", List.of("a")), + new AbstractMap.SimpleEntry<>("param2", List.of("3.14")) + ); + Map> headers = new HeaderParametersSerializer().serialize(inData); + Assert.assertEquals(expectedHeaders, headers); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/PathSerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/PathSerializerTest.hbs new file mode 100644 index 00000000000..4d69c221e56 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/PathSerializerTest.hbs @@ -0,0 +1,46 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class PathSerializerTest { + public static class Parameter1 extends SchemaParameter { + public Parameter1() { + super("param1", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Parameter2 extends SchemaParameter { + public Parameter2() { + super("param2", ParameterInType.PATH, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class PathParametersSerializer extends PathSerializer { + protected PathParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Parameter1()), + new AbstractMap.SimpleEntry<>("param2", new Parameter2()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + String pathWithPlaceholders = "/{param1}/{param2}"; + String path = new PathParametersSerializer().serialize(inData, pathWithPlaceholders); + String expectedPath = "/a/3.14"; + Assert.assertEquals(expectedPath, path); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs new file mode 100644 index 00000000000..5b7109bd38f --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/QuerySerializerTest.hbs @@ -0,0 +1,52 @@ +package {{{packageName}}}.parameter; + +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.AbstractMap; +import java.util.Map; + +public class QuerySerializerTest { + public static class Param1QueryParameter extends SchemaParameter { + public Param1QueryParameter() { + super("param1", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class Param2QueryParameter extends SchemaParameter { + public Param2QueryParameter() { + super("param2", ParameterInType.QUERY, true, null, null, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + public static class QueryParametersSerializer extends QuerySerializer { + protected QueryParametersSerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", new Param1QueryParameter()), + new AbstractMap.SimpleEntry<>("param2", new Param2QueryParameter()) + ) + ); + } + } + + @Test + public void testSerialization() throws NotImplementedException { + Map inData = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "a"), + new AbstractMap.SimpleEntry<>("param2", 3.14d) + ); + var serializer = new QueryParametersSerializer(); + var queryMap = serializer.getQueryMap(inData); + Map expectedQueryMap = Map.ofEntries( + new AbstractMap.SimpleEntry<>("param1", "param1=a"), + new AbstractMap.SimpleEntry<>("param2", "param2=3.14") + ); + Assert.assertEquals(expectedQueryMap, queryMap); + String query = serializer.serialize(queryMap); + String expectedQuery = "?param1=a¶m2=3.14"; + Assert.assertEquals(expectedQuery, query); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs new file mode 100644 index 00000000000..f0b9a7c1aa6 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaNonQueryParameterTest.hbs @@ -0,0 +1,397 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.AbstractMap; +import java.util.Set; + +public class SchemaNonQueryParameterTest { + public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + public static class HeaderParameter extends SchemaParameter { + public HeaderParameter(@Nullable Boolean explode) { + super("color", ParameterInType.HEADER, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testHeaderSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "hello world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var header = new HeaderParameter(testCase.explode); + var serialization = header.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var boolHeader = new HeaderParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> boolHeader.serialize(value) + ); + } + } + + public static class PathParameter extends SchemaParameter { + public PathParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue,black,brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100,G=200,B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var pathParameter = new PathParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> pathParameter.serialize(value) + ); + } + } + + public static class CookieParameter extends SchemaParameter { + public CookieParameter(@Nullable Boolean explode) { + super("color", ParameterInType.COOKIE, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testCookieSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "color=hello world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "color=") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var cookieParameter = new CookieParameter(testCase.explode); + var serialization = cookieParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var cookieParameter = new CookieParameter(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> cookieParameter.serialize(value) + ); + } + } + + public static class PathMatrixParameter extends SchemaParameter { + public PathMatrixParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, ParameterStyle.MATRIX, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathMatrixSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", ";color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color",";color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", ";color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", ";color=hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", ";color") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ";color=blue,black,brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ";color=blue;color=black;color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ";color=R,100,G,200,B,150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ";R=100;G=200;B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathMatrixParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } + + public static class PathLabelParameter extends SchemaParameter { + public PathLabelParameter(@Nullable Boolean explode) { + super("color", ParameterInType.PATH, true, ParameterStyle.LABEL, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testPathLabelSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", ".1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color",".3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", ".blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", ".hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", ".") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ".blue.black.brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", ".blue.black.brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ".R.100.G.200.B.150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", ".R=100.G=200.B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var pathParameter = new PathLabelParameter(testCase.explode); + var serialization = pathParameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs new file mode 100644 index 00000000000..d6e4206daba --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/parameter/SchemaQueryParameterTest.hbs @@ -0,0 +1,193 @@ +package {{{packageName}}}.parameter; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.AbstractMap; +import java.util.Map; +import java.util.Set; + +public class SchemaQueryParameterTest { + public record ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization, @Nullable Boolean explode) { + public ParamTestCase(@Nullable Object payload, AbstractMap.SimpleEntry expectedSerialization) { + this(payload, expectedSerialization, null); + } + } + + public static class QueryParameterNoStyle extends SchemaParameter { + public QueryParameterNoStyle(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, null, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterNoStyleSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + null, + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + 1, + new AbstractMap.SimpleEntry<>("color", "color=1") + ), + new ParamTestCase( + 3.14, + new AbstractMap.SimpleEntry<>("color","color=3.14") + ), + new ParamTestCase( + "blue", + new AbstractMap.SimpleEntry<>("color", "color=blue") + ), + new ParamTestCase( + "hello world", + new AbstractMap.SimpleEntry<>("color", "color=hello%20world") + ), + new ParamTestCase( + "", + new AbstractMap.SimpleEntry<>("color", "color=") + ), + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "color=blue&color=black&color=brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100&G=200&B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterNoStyle(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + var parameter = new QueryParameterNoStyle(false); + for (boolean value: Set.of(true, false)) { + Assert.assertThrows( + NotImplementedException.class, + () -> parameter.serialize(value) + ); + } + } + + public static class QueryParameterSpaceDelimited extends SchemaParameter { + public QueryParameterSpaceDelimited(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, ParameterStyle.SPACE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterSpaceDelimitedSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue%20black%20brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R%20100%20G%20200%20B%20150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100%20G=200%20B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterSpaceDelimited(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } + + public static class QueryParameterPipeDelimited extends SchemaParameter { + public QueryParameterPipeDelimited(@Nullable Boolean explode) { + super("color", ParameterInType.QUERY, true, ParameterStyle.PIPE_DELIMITED, explode, null, AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + } + + @Test + public void testQueryParameterPipeDelimitedSerialization() throws NotImplementedException { + var mapPayload = new LinkedHashMap(); + mapPayload.put("R", 100); + mapPayload.put("G", 200); + mapPayload.put("B", 150); + List testCases = List.of( + new ParamTestCase( + List.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue|black|brown") + ), + new ParamTestCase( + List.of("blue", "black", "brown"), + new AbstractMap.SimpleEntry<>("color", "blue|black|brown"), + true + ), + new ParamTestCase( + Map.of(), + new AbstractMap.SimpleEntry<>("color", "") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R|100|G|200|B|150") + ), + new ParamTestCase( + mapPayload, + new AbstractMap.SimpleEntry<>("color", "R=100|G=200|B=150"), + true + ) + ); + for (ParamTestCase testCase: testCases) { + var parameter = new QueryParameterPipeDelimited(testCase.explode); + var serialization = parameter.serialize(testCase.payload); + Assert.assertEquals(testCase.expectedSerialization, serialization); + } + } +} diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs new file mode 100644 index 00000000000..b8c071ab29d --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/requestbody/RequestBodySerializerTest.hbs @@ -0,0 +1,181 @@ +package {{{packageName}}}.requestbody; + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.contenttype.ContentTypeDetector; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; +import {{{packageName}}}.schemas.StringJsonSchema; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; + +import java.net.http.HttpResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.AbstractMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Flow; + +public final class RequestBodySerializerTest { + public sealed interface SealedMediaType permits ApplicationjsonMediaType, TextplainMediaType {} + public record ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType {} + public record TextplainMediaType(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType {} + + public sealed interface SealedRequestBody permits ApplicationjsonRequestBody, TextplainRequestBody {} + public record ApplicationjsonRequestBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { + @Override + public String contentType() { + return "application/json"; + } + } + public record TextplainRequestBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedRequestBody, GenericRequestBody<@Nullable Object> { + @Override + public String contentType() { + return "text/plain"; + } + } + + public static class MyRequestBodySerializer extends RequestBodySerializer { + public MyRequestBodySerializer() { + super( + Map.ofEntries( + new AbstractMap.SimpleEntry<>("application/json", new ApplicationjsonMediaType(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance())), + new AbstractMap.SimpleEntry<>("text/plain", new TextplainMediaType(StringJsonSchema.StringJsonSchema1.getInstance())) + ), + true); + } + + public SerializedRequestBody serialize(SealedRequestBody requestBody) throws NotImplementedException { + if (requestBody instanceof ApplicationjsonRequestBody requestBody0) { + return serialize(requestBody0.contentType(), requestBody0.body().getData()); + } else { + TextplainRequestBody requestBody1 = (TextplainRequestBody) requestBody; + return serialize(requestBody1.contentType(), requestBody1.body().getData()); + } + } + } + + @Test + public void testContentTypeIsJson() { + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json; charset=UTF-8")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/json-patch+json")); + Assert.assertTrue(ContentTypeDetector.contentTypeIsJson("application/geo+json")); + + Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("application/octet-stream")); + Assert.assertFalse(ContentTypeDetector.contentTypeIsJson("text/plain")); + } + + static final class StringSubscriber implements Flow.Subscriber { + final HttpResponse.BodySubscriber wrapped; + StringSubscriber(HttpResponse.BodySubscriber wrapped) { + this.wrapped = wrapped; + } + @Override + public void onSubscribe(Flow.Subscription subscription) { + wrapped.onSubscribe(subscription); + } + @Override + public void onNext(ByteBuffer item) { wrapped.onNext(List.of(item)); } + @Override + public void onError(Throwable throwable) { wrapped.onError(throwable); } + @Override + public void onComplete() { wrapped.onComplete(); } + } + + private String getJsonBody(SerializedRequestBody requestBody) { + var bodySubscriber = HttpResponse.BodySubscribers.ofString(StandardCharsets.UTF_8); + var flowSubscriber = new StringSubscriber(bodySubscriber); + requestBody.bodyPublisher.subscribe(flowSubscriber); + return bodySubscriber.getBody().toCompletableFuture().join(); + } + + @Test + public void testSerializeApplicationJson() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + var serializer = new MyRequestBodySerializer(); + String jsonBody; + SerializedRequestBody requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(1, configuration) + ) + ); + Assert.assertEquals("application/json", requestBody.contentType); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "1"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(3.14, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "3.14"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox((Nothing?) null, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "null"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(true, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "true"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(false, configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "false"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(List.of(), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "[]"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of(), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "{}"); + + requestBody = serializer.serialize( + new ApplicationjsonRequestBody( + AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance().validateAndBox(Map.of("k1", "v1", "k2", "v2"), configuration) + ) + ); + jsonBody = getJsonBody(requestBody); + Assert.assertEquals(jsonBody, "{\"k2\":\"v2\",\"k1\":\"v1\"}"); + } + + @Test + public void testSerializeTextPlain() throws ValidationException, NotImplementedException { + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + var serializer = new MyRequestBodySerializer(); + SerializedRequestBody requestBody = serializer.serialize( + new TextplainRequestBody( + StringJsonSchema.StringJsonSchema1.getInstance().validateAndBox("a", configuration) + ) + ); + Assert.assertEquals("text/plain", requestBody.contentType); + String textBody = getJsonBody(requestBody); + Assert.assertEquals(textBody, "a"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs new file mode 100644 index 00000000000..4611631e6ae --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/response/ResponseDeserializerTest.hbs @@ -0,0 +1,248 @@ +package {{{packageName}}}.response; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.ToNumberPolicy; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.junit.Assert; +import org.junit.Test; +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags; +import {{{packageName}}}.configurations.SchemaConfiguration; +import {{{packageName}}}.exceptions.NotImplementedException; +import {{{packageName}}}.exceptions.ApiException; +import {{{packageName}}}.exceptions.ValidationException; +import {{{packageName}}}.mediatype.MediaType; +import {{{packageName}}}.schemas.AnyTypeJsonSchema; +import {{{packageName}}}.schemas.StringJsonSchema; + +import javax.net.ssl.SSLSession; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.BiPredicate; + +public class ResponseDeserializerTest { + private static final Gson gson = new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .setNumberToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .create(); + public sealed interface SealedResponseBody permits ApplicationjsonBody, TextplainBody { } + + public record ApplicationjsonBody(AnyTypeJsonSchema.AnyTypeJsonSchema1Boxed body) implements SealedResponseBody { } + + public record TextplainBody(StringJsonSchema.StringJsonSchema1Boxed body) implements SealedResponseBody {} + + public sealed interface SealedMediaType permits ApplicationjsonMediatype, TextplainMediatype { } + + public record ApplicationjsonMediatype(AnyTypeJsonSchema.AnyTypeJsonSchema1 schema) implements SealedMediaType, MediaType { + public ApplicationjsonMediatype() { + this(AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public record TextplainMediatype(StringJsonSchema.StringJsonSchema1 schema) implements SealedMediaType, MediaType { + public TextplainMediatype() { + this(StringJsonSchema.StringJsonSchema1.getInstance()); + } + @Override + public Nothing? encoding() { + return null; + } + } + + public static class MyResponseDeserializer extends ResponseDeserializer { + + public MyResponseDeserializer() { + super(Map.of("application/json", new ApplicationjsonMediatype(), "text/plain", new TextplainMediatype())); + } + + @Override + protected SealedResponseBody getBody(String contentType, SealedMediaType mediaType, byte[] body, SchemaConfiguration configuration) throws ValidationException, NotImplementedException { + if (mediaType instanceof ApplicationjsonMediatype thisMediaType) { + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new ApplicationjsonBody(deserializedBody); + } else { + TextplainMediatype thisMediaType = (TextplainMediatype) mediaType; + var deserializedBody = deserializeBody(contentType, body, thisMediaType.schema(), configuration); + return new TextplainBody(deserializedBody); + } + } + + @Override + protected Nothing? getHeaders(HttpHeaders headers, SchemaConfiguration configuration) { + return null; + } + } + + public static class BytesHttpResponse implements HttpResponse { + private final byte[] body; + private final HttpHeaders headers; + private final HttpRequest request; + private final URI uri; + private final HttpClient.Version version; + public BytesHttpResponse(byte[] body, String contentType) { + this.body = body; + BiPredicate headerFilter = (key, val) -> true; + headers = HttpHeaders.of(Map.of("Content-Type", List.of(contentType)), headerFilter); + uri = URI.create("https://abc.com/"); + request = HttpRequest.newBuilder().uri(uri).build(); + version = HttpClient.Version.HTTP_2; + } + + @Override + public int statusCode() { + return 202; + } + + @Override + public HttpRequest request() { + return request; + } + + @Override + public Optional> previousResponse() { + return Optional.empty(); + } + + @Override + public HttpHeaders headers() { + return headers; + } + + @Override + public byte[] body() { + return body; + } + + @Override + public Optional sslSession() { + return Optional.empty(); + } + + @Override + public URI uri() { + return uri; + } + + @Override + public HttpClient.Version version() { + return version; + } + } + + @SuppressWarnings("nullness") + private String toJson(@Nullable Object body) { + return gson.toJson(body); + } + + @SuppressWarnings("nullness") + private void assertNull(@Nullable Object object) { + Assert.assertNull(object); + } + + @Test + public void testDeserializeApplicationJsonNull() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(null).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedVoid boxedVoid)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedVoid"); + } + assertNull(boxedVoid.data()); + } + + @Test + public void testDeserializeApplicationJsonTrue() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(true).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); + } + Assert.assertTrue(boxedBoolean.data()); + } + + @Test + public void testDeserializeApplicationJsonFalse() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(false).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedBoolean boxedBoolean)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedBoolean"); + } + Assert.assertFalse(boxedBoolean.data()); + } + + @Test + public void testDeserializeApplicationJsonInt() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(1).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); + } + Assert.assertEquals(boxedNumber.data(), 1L); + } + + @Test + public void testDeserializeApplicationJsonFloat() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson(3.14).getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedNumber boxedNumber)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedNumber"); + } + Assert.assertEquals(boxedNumber.data(), 3.14); + } + + @Test + public void testDeserializeApplicationJsonString() throws ValidationException, ApiException, NotImplementedException { + var deserializer = new MyResponseDeserializer(); + byte[] bodyBytes = toJson("a").getBytes(StandardCharsets.UTF_8); + BytesHttpResponse response = new BytesHttpResponse(bodyBytes, "application/json"); + SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build()); + DeserializedHttpResponse apiResponse = deserializer.deserialize(response, configuration); + if (!(apiResponse.body() instanceof ApplicationjsonBody jsonBody)) { + throw new RuntimeException("body must be type ApplicationjsonBody"); + } + if (!(jsonBody.body() instanceof AnyTypeJsonSchema.AnyTypeJsonSchema1BoxedString boxedString)) { + throw new RuntimeException("body must be type AnyTypeJsonSchema1BoxedString"); + } + Assert.assertEquals(boxedString.data(), "a"); + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs new file mode 100644 index 00000000000..0fe31c6a596 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/AnyTypeSchemaTest.hbs @@ -0,0 +1,113 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.FrozenMap + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class AnyTypeSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = schema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateBoolean() { + val trueValue = schema.validate(true, configuration) + assertTrue(trueValue) + val falseValue = schema.validate(false, configuration) + assertFalse(falseValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = schema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = schema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = schema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = schema.validate(70.6458763, configuration) + assertEquals(validatedValue.compareTo(70.6458763).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateString() { + val validatedValue = schema.validate("a", configuration) + assertEquals(validatedValue, "a") + } + + @Test + @Throws(ValidationException::class) + fun testValidateZonedDateTime() { + val validatedValue = + schema.validate(ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, ZoneId.of("Z")), configuration) + assertEquals(validatedValue, "2017-07-21T17:32:28Z") + } + + @Test + @Throws(ValidationException::class) + fun testValidateLocalDate() { + val validatedValue = schema.validate(LocalDate.of(2017, 7, 21), configuration) + assertEquals(validatedValue, "2017-07-21") + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap = mapOf( + "today" to LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenMap<*> = schema.validate(inMap, configuration) + val outMap: Map = mapOf( + "today" to "2017-07-21" + ) + assertEquals(validatedValue, outMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList = listOf( + LocalDate.of(2017, 7, 21) + ) + val validatedValue: FrozenList<*> = schema.validate(inList, configuration) + val outList: List = listOf("2017-07-21") + assertEquals(validatedValue, outList) + } + + companion object { + val schema = AnyTypeJsonSchema.AnyTypeJsonSchema1.getInstance() + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs new file mode 100644 index 00000000000..448476ab991 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ArrayTypeSchemaTest.hbs @@ -0,0 +1,251 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ListSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ArrayTypeSchemaTest { + sealed interface ArrayWithItemsSchemaBoxed + + data class ArrayWithItemsSchemaBoxedList(val data: FrozenList) : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator, ArrayWithItemsSchemaBoxedList> { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + return FrozenList(items) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): FrozenList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxedList { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithItemsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + class ArrayWithOutputClsSchemaList(m: FrozenList) : FrozenList(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: List, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + return ArrayWithOutputClsSchema().validate(arg, configuration) + } + } + } + + interface ArrayWithOutputClsSchemaBoxed + + data class ArrayWithOutputClsSchemaBoxedList(val data: ArrayWithOutputClsSchemaList) : + ArrayWithOutputClsSchemaBoxed + + class ArrayWithOutputClsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ), ListSchemaValidator { + override fun getNewInstance( + arg: List<*>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ArrayWithOutputClsSchemaList { + val items: MutableList = ArrayList() + var i = 0 + for (item in arg) { + val itemPathToItem: MutableList = ArrayList(pathToItem) + itemPathToItem.add(i) + val schemas = pathToSchemas[itemPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val itemSchema = schemas.entries.iterator().next().key + val castItem = itemSchema.getNewInstance(item, itemPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Instantiated type of item is invalid") + items.add(castItem) + i += 1 + } + val newInstanceItems = FrozenList(items) + return ArrayWithOutputClsSchemaList(newInstanceItems) + } + + @Throws(ValidationException::class) + override fun validate(arg: List<*>, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaList { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: List<*> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: List<*>, + configuration: SchemaConfiguration? + ): ArrayWithOutputClsSchemaBoxedList { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg as List<*>?, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithOutputClsSchemaBoxed { + if (arg is List<*>) { + return ArrayWithOutputClsSchemaBoxedList(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithItemsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue: FrozenList = ArrayWithItemsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithItemsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithItemsSchema(), + intList, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateArrayWithOutputClsSchema() { + // list with only item works + var inList: List = listOf("abc") + var validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + var outList: List = listOf("abc") + assertEquals(validatedValue, outList) + + // list with no items works + inList = listOf() + validatedValue = ArrayWithOutputClsSchema().validate(inList, configuration) + outList = listOf() + assertEquals(validatedValue, outList) + + // invalid item type fails + val intList = listOf(1) + assertFailsWith( + block = { + JsonSchema.validate( + ArrayWithOutputClsSchema(), + intList, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs new file mode 100644 index 00000000000..71cb0d28cac --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/BooleanSchemaTest.hbs @@ -0,0 +1,53 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class BooleanSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = booleanJsonSchema.validate(true, configuration) + assertTrue(validatedValue) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = booleanJsonSchema.validate(false, configuration) + assertFalse(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + booleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val booleanJsonSchema = BooleanJsonSchema.BooleanJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs new file mode 100644 index 00000000000..dd1c86bd7f1 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListBuilderTest.hbs @@ -0,0 +1,55 @@ +package {{{packageName}}}.schemas + +import kotlin.test.Test +import kotlin.test.assertEquals + +class ListBuilderTest { + class NullableListWithNullableItemsListBuilder { + // class to build List<@Nullable List> + private val list: MutableList?> + + constructor() { + list = ArrayList() + } + + constructor(list: MutableList?>) { + this.list = list + } + + fun add(item: Nothing?): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun add(item: List): NullableListWithNullableItemsListBuilder { + list.add(item) + return this + } + + fun build(): List?> { + return list + } + } + + @Test + fun testSucceedsWithNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(null) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(null) + assertEquals(inList, builder.build()) + } + + @Test + fun testSucceedsWithNonNullInput() { + val inList: MutableList?> = ArrayList() + inList.add(listOf(1)) + var builder = NullableListWithNullableItemsListBuilder(inList) + assertEquals(inList, builder.build()) + builder = NullableListWithNullableItemsListBuilder() + builder.add(listOf(1)) + assertEquals(inList, builder.build()) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs new file mode 100644 index 00000000000..b72f7ca5f9f --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ListSchemaTest.hbs @@ -0,0 +1,49 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.FrozenList +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ListSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + listJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateList() { + val inList: MutableList = ArrayList() + inList.add("today") + val validatedValue = listJsonSchema.validate(inList, configuration) + val outList: List = listOf("today") + assertEquals(validatedValue, outList) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val listJsonSchema = ListJsonSchema.ListJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs new file mode 100644 index 00000000000..440e4414def --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/MapSchemaTest.hbs @@ -0,0 +1,50 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import java.time.LocalDate +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class MapSchemaTest { + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + mapJsonSchema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateMap() { + val inMap: MutableMap = LinkedHashMap() + inMap["today"] = LocalDate.of(2017, 7, 21) + val validatedValue = mapJsonSchema.validate(inMap, configuration) + val outMap: Map = mapOf("today" to "2017-07-21") + assertEquals(validatedValue, outMap) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val mapJsonSchema = MapJsonSchema.MapJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs new file mode 100644 index 00000000000..2c950ef0776 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NullSchemaTest.hbs @@ -0,0 +1,46 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.Throws +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class NullSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateNull() { + val validatedValue: Nothing? = nullJsonSchema.validate(null, configuration) + assertNull(validatedValue) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + nullJsonSchema, + true, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val nullJsonSchema = NullJsonSchema.NullJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs new file mode 100644 index 00000000000..19d2a63c15d --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/NumberSchemaTest.hbs @@ -0,0 +1,66 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class NumberSchemaTest { + @Test + @Throws(ValidationException::class) + fun testValidateInteger() { + val validatedValue = numberJsonSchema.validate(1, configuration) + assertEquals(validatedValue.toLong(), 1) + } + + @Test + @Throws(ValidationException::class) + fun testValidateLong() { + val validatedValue = numberJsonSchema.validate(1L, configuration) + assertEquals(validatedValue, 1L) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFloat() { + val validatedValue = numberJsonSchema.validate(3.14f, configuration) + assertEquals(validatedValue.compareTo(3.14f).toLong(), 0) + } + + @Test + @Throws(ValidationException::class) + fun testValidateDouble() { + val validatedValue = numberJsonSchema.validate(3.14, configuration) + assertEquals(validatedValue.compareTo(3.14).toLong(), 0) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + numberJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val numberJsonSchema = NumberJsonSchema.NumberJsonSchema1.getInstance() + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs new file mode 100644 index 00000000000..5cf30dc12cd --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/ObjectTypeSchemaTest.hbs @@ -0,0 +1,569 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.JsonSchemaInfo +import {{{packageName}}}.schemas.validation.FrozenMap +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.MapSchemaValidator +import {{{packageName}}}.schemas.validation.ValidationMetadata + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class ObjectTypeSchemaTest { + interface ObjectWithPropsSchemaBoxed + + data class ObjectWithPropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator, ObjectWithPropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsSchemaBoxedMap { + return ObjectWithPropsSchemaBoxedMap(validate(arg, configuration)) + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsSchemaBoxedMap( + validate(arg, configuration) + ) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + interface ObjectWithAddpropsSchemaBoxed + + data class ObjectWithAddpropsSchemaBoxedMap(val data: FrozenMap) : ObjectWithAddpropsSchemaBoxed {} + + class ObjectWithAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) as? String + ?: throw RuntimeException("Invalid type for property value") + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithAddpropsSchemaBoxedMap { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithAddpropsSchema().also { instance = it } + } + } + } + + interface ObjectWithPropsAndAddpropsSchemaBoxed + + data class ObjectWithPropsAndAddpropsSchemaBoxedMap(val data: FrozenMap) : + ObjectWithPropsAndAddpropsSchemaBoxed { + } + + class ObjectWithPropsAndAddpropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(BooleanJsonSchema.BooleanJsonSchema1::class.java) + ), MapSchemaValidator, ObjectWithPropsAndAddpropsSchemaBoxedMap> { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): FrozenMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return FrozenMap(properties) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): FrozenMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxedMap { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Any?, + configuration: SchemaConfiguration? + ): ObjectWithPropsAndAddpropsSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithPropsAndAddpropsSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithPropsAndAddpropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsAndAddpropsSchema().also { instance = it } + } + } + } + + class ObjectWithOutputTypeSchemaMap(m: FrozenMap) : FrozenMap(m) { + companion object { + @Throws(ValidationException::class) + fun of(arg: Map, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + return ObjectWithOutputTypeSchema.getInstance().validate(arg, configuration) + } + } + } + + interface ObjectWithOutputTypeSchemaBoxed + + data class ObjectWithOutputTypeSchemaBoxedMap(val data: ObjectWithOutputTypeSchemaMap) : + ObjectWithOutputTypeSchemaBoxed { + } + + class ObjectWithOutputTypeSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ), MapSchemaValidator { + override fun getNewInstance( + arg: Map<*, *>, + pathToItem: List, + pathToSchemas: PathToSchemasMap + ): ObjectWithOutputTypeSchemaMap { + val properties = LinkedHashMap() + for ((entryKey, value1) in arg) { + if (entryKey !is String) { + throw RuntimeException("Invalid non-string key value") + } + val propertyPathToItem: MutableList = ArrayList(pathToItem) + propertyPathToItem.add(entryKey) + val value = value1!! + val schemas = pathToSchemas[propertyPathToItem] + ?: throw RuntimeException("Validation result is invalid, schemas must exist for a pathToItem") + val propertySchema = schemas.entries.iterator().next().key + val castValue = propertySchema.getNewInstance(value, propertyPathToItem, pathToSchemas) + properties[entryKey] = castValue + } + return ObjectWithOutputTypeSchemaMap(FrozenMap(properties)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Map<*, *>, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaMap { + val pathSet: MutableSet> = HashSet() + val pathToItem = listOf("args[0") + val castArg: Map<*, *> = castToAllowedTypes(arg, pathToItem, pathSet) + val usedConfiguration = configuration ?: SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = + ValidationMetadata(pathToItem, usedConfiguration, PathToSchemasMap(), LinkedHashSet()) + val pathToSchemasMap = getPathToSchemas(this, castArg, validationMetadata, pathSet) + return getNewInstance(castArg, validationMetadata.pathToItem, pathToSchemasMap) + } + + @Throws(ValidationException::class) + override fun validateAndBox( + arg: Map<*, *>, + configuration: SchemaConfiguration? + ): ObjectWithOutputTypeSchemaBoxedMap { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithOutputTypeSchemaBoxed { + if (arg is Map<*, *>) { + return ObjectWithOutputTypeSchemaBoxedMap(validate(arg, configuration)) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is FrozenMap<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + companion object { + @Volatile + private var instance: ObjectWithOutputTypeSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithOutputTypeSchema().also { instance = it } + } + } + } + + @Test + fun testExceptionThrownForInvalidType() { + val schema = ObjectWithPropsSchema.getInstance() + assertFailsWith( + block = { + JsonSchema.validate( + schema, + null, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsSchema() { + val schema = ObjectWithPropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithAddpropsSchema() { + val schema = ObjectWithAddpropsSchema.getInstance() + + // map with only property works + var inMap: MutableMap = LinkedHashMap() + inMap["someString"] = "abc" + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = LinkedHashMap() + inMap["someString"] = "abc" + inMap["someOtherString"] = "def" + validatedValue = schema.validate(inMap, configuration) + outMap = mapOf( + "someString" to "abc", + "someOtherString" to "def" + ) + assertEquals(validatedValue, outMap) + + // invalid addProp type fails + val invalidInput = java.util.Map.of("someString", 1) + assertFailsWith( + block = { + JsonSchema.validate( + schema, + invalidInput, + validationMetadata + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithPropsAndAddpropsSchema() { + val schema = ObjectWithPropsAndAddpropsSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue: Map = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional properties works + inMap = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someAddProp" to true + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + inMap = mapOf("someString" to 1) + val invalidPropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidPropMap, configuration + ) + } + ) + + // invalid addProp type fails + inMap = LinkedHashMap() + inMap["someAddProp"] = 1 + val invalidAddpropMap: Map = inMap + assertFailsWith( + block = { + schema.validate( + invalidAddpropMap, configuration + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidateObjectWithOutputTypeSchema() { + val schema = ObjectWithOutputTypeSchema.getInstance() + + // map with only property works + var inMap: Map = mapOf("someString" to "abc") + var validatedValue = schema.validate(inMap, configuration) + var outMap: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap) + + // map with additional unvalidated property works + inMap = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + validatedValue = schema.validate(inMap, configuration) + val outMap1: Map = mapOf( + "someString" to "abc", + "someOtherString" to "def", + ) + assertEquals(validatedValue, outMap1) + + // invalid prop type fails + val invalidInMap = mapOf("someString" to 1) + assertFailsWith( + block = { + schema.validate( + invalidInMap, configuration + ) + } + ) + + // using output class directly works + inMap = mapOf("someString" to "abc") + validatedValue = ObjectWithOutputTypeSchemaMap.of(inMap, configuration) + val outMap2: Map = mapOf("someString" to "abc") + assertEquals(validatedValue, outMap2) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs new file mode 100644 index 00000000000..e40febe734b --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/RefBooleanSchemaTest.hbs @@ -0,0 +1,67 @@ +package {{{packageName}}}.schemas + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.validation.JsonSchema +import {{{packageName}}}.schemas.validation.PathToSchemasMap +import {{{packageName}}}.schemas.validation.ValidationMetadata +import {{{packageName}}}.schemas.validation.JsonSchemaFactory + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +class RefBooleanSchemaTest { + class RefBooleanSchema { + class RefBooleanSchema1 : BooleanJsonSchema.BooleanJsonSchema1() { + companion object { + @Volatile + private var instance: RefBooleanSchema1? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: RefBooleanSchema1().also { instance = it } + } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateTrue() { + val validatedValue = refBooleanJsonSchema.validate(true, configuration) + assertEquals(validatedValue, true) + } + + @Test + @Throws(ValidationException::class) + fun testValidateFalse() { + val validatedValue = refBooleanJsonSchema.validate(false, configuration) + assertEquals(validatedValue, false) + } + + @Test + fun testExceptionThrownForInvalidType() { + assertFailsWith( + block = { + JsonSchema.validate( + refBooleanJsonSchema, + null, + validationMetadata + ) + } + ) + } + + companion object { + val configuration = SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()) + val refBooleanJsonSchema = JsonSchemaFactory.getInstance(RefBooleanSchema.RefBooleanSchema1::class.java) + val validationMetadata = ValidationMetadata( + listOf("args[0"), + configuration, + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs new file mode 100644 index 00000000000..b14aa275acf --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/AdditionalPropertiesValidatorTest.hbs @@ -0,0 +1,140 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.MapJsonSchema +import {{{packageName}}}.schemas.StringJsonSchema +import {{{packageName}}}.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + + +class AdditionalPropertiesValidatorTest { + sealed interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + .additionalProperties(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Map<*, *> { + if (arg is Map<*, *>) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + + companion object { + @Volatile + private var instance: ObjectWithPropsSchema? = null + + fun getInstance() = + instance ?: synchronized(this) { + instance ?: ObjectWithPropsSchema().also { instance = it } + } + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = "def" + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someAddProp") + + val expectedClasses: LinkedHashMap, Nothing?> = LinkedHashMap() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = AdditionalPropertiesValidator() + val pathToSchemas = validator.validate( + ValidationData( + MapJsonSchema.MapJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = java.util.LinkedHashMap() + mutableMap["someString"] = "abc" + mutableMap["someAddProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = AdditionalPropertiesValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema.getInstance(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs new file mode 100644 index 00000000000..20d24c5d454 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/CustomIsoparserTest.hbs @@ -0,0 +1,25 @@ +package {{{packageName}}}.schemas.validation + +import java.time.LocalDate +import java.time.ZoneId +import java.time.ZonedDateTime + +import kotlin.test.Test +import kotlin.test.assertEquals + +class CustomIsoparserTest { + @Test + fun testParseIsodatetime() { + val dateTime: ZonedDateTime = CustomIsoparser.parseIsodatetime("2017-07-21T17:32:28Z") + val zone = ZoneId.of("Z") + val expectedDateTime = ZonedDateTime.of(2017, 7, 21, 17, 32, 28, 0, zone) + assertEquals(dateTime, expectedDateTime) + } + + @Test + fun testParseIsodate() { + val date: LocalDate = CustomIsoparser.parseIsodate("2017-07-21") + val expectedDate = LocalDate.of(2017, 7, 21) + assertEquals(date, expectedDate) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs new file mode 100644 index 00000000000..d4fba01fc1f --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/FormatValidatorTest.hbs @@ -0,0 +1,418 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.IntJsonSchema +import {{{packageName}}}.schemas.Int32JsonSchema +import {{{packageName}}}.schemas.Int64JsonSchema +import {{{packageName}}}.schemas.FloatJsonSchema +import {{{packageName}}}.schemas.DoubleJsonSchema +import {{{packageName}}}.schemas.DecimalJsonSchema +import {{{packageName}}}.schemas.DateJsonSchema +import {{{packageName}}}.schemas.DateTimeJsonSchema + +import java.math.BigDecimal +import java.math.BigInteger +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class FormatValidatorTest { + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithFloat() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1.0f, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testIntFormatFailsWithFloat() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 3.14f, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testIntFormatSucceedsWithInt() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + IntJsonSchema.IntJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483649L, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + -2147483648, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt32InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483647, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt32OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int32JsonSchema.Int32JsonSchema1.getInstance(), + 2147483648L, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInt64UnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("-9223372036854775809"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + Long.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testInt64InclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + 9223372036854775807L, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInt64OverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + Int64JsonSchema.Int64JsonSchema1.getInstance(), + BigInteger("9223372036854775808"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testFloatUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + -3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MIN_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testFloatInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + Float.MAX_VALUE, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testFloatOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + FloatJsonSchema.FloatJsonSchema1.getInstance(), + 3.402823466385289e+38, + validationMetadata + ) + ) + } + ) + } + + @Test + fun testDoubleUnderMinFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("-1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMinSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + -1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testDoubleInclusiveMaxSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + 1.7976931348623157E+308, + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testDoubleOverMaxFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DoubleJsonSchema.DoubleJsonSchema1.getInstance(), + BigDecimal("1.7976931348623157082e+308"), + validationMetadata + ) + ) + } + ) + } + + @Test + fun testInvalidNumberStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidFloatNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "3.14", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + @Throws(ValidationException::class) + fun testValidIntNumberStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DecimalJsonSchema.DecimalJsonSchema1.getInstance(), + "1", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateJsonSchema.DateJsonSchema1.getInstance(), + "2017-01-20", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testInvalidDateTimeStringFails() { + val validator = FormatValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "abc", + validationMetadata + ) + ) + } + ) + } + + @Test + @Throws(ValidationException::class) + fun testValidDateTimeStringSucceeds() { + val validator = FormatValidator() + val pathToSchemasMap = validator.validate( + ValidationData( + DateTimeJsonSchema.DateTimeJsonSchema1.getInstance(), + "2017-07-21T17:32:28Z", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + companion object { + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs new file mode 100644 index 00000000000..39faeb257c1 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/ItemsValidatorTest.hbs @@ -0,0 +1,120 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.schemas.StringJsonSchema +import {{{packageName}}}.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class ItemsValidatorTest { + interface ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchemaBoxedList : ArrayWithItemsSchemaBoxed + class ArrayWithItemsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(List::class.java)) + .items(StringJsonSchema.StringJsonSchema1::class.java) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is List<*>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is List<*>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ArrayWithItemsSchemaBoxed { + return ArrayWithItemsSchemaBoxedList() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectItemsSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add("a") + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value in pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add(0) + val expectedClasses = LinkedHashMap, Nothing?>() + val schema = JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java) + expectedClasses[schema] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = ItemsValidator() + val pathToSchemas = validator.validate( + ValidationData( + ArrayWithItemsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectItemFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableList: MutableList = ArrayList() + mutableList.add(1) + val arg = FrozenList(mutableList) + val validator = ItemsValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ArrayWithItemsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs new file mode 100644 index 00000000000..3b57ceac66f --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/JsonSchemaTest.hbs @@ -0,0 +1,71 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertEquals + +class JsonSchemaTest { + internal sealed interface SomeSchemaBoxed + internal class SomeSchemaBoxedString : SomeSchemaBoxed + internal class SomeSchema private constructor() : JsonSchema( + JsonSchemaInfo() + .type(setOf(String::class.java)) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is String) { + return arg + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is String) { + return arg + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): SomeSchemaBoxed { + return SomeSchemaBoxedString() + } + + companion object { + var instance: SomeSchema? = null + get() { + if (field == null) { + field = SomeSchema() + } + return field + } + private set + } + } + + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val schema = JsonSchemaFactory.getInstance(SomeSchema::class.java) + val pathToSchemas = JsonSchema.validate( + schema, + "hi", + validationMetadata + ) + val expectedPathToSchemas = PathToSchemasMap() + val validatedClasses = LinkedHashMap, Nothing?>() + validatedClasses[schema] = null + expectedPathToSchemas[pathToItem] = validatedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs new file mode 100644 index 00000000000..7d577f00958 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/PropertiesValidatorTest.hbs @@ -0,0 +1,123 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNull +import kotlin.test.assertFailsWith + +class PropertiesValidatorTest { + interface ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchemaBoxedMap : ObjectWithPropsSchemaBoxed + class ObjectWithPropsSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(MutableMap::class.java)) + .properties( + mapOf( + "someString" to StringJsonSchema.StringJsonSchema1::class.java + ) + ) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithPropsSchemaBoxed { + return ObjectWithPropsSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) ?: throw RuntimeException("Invalid null value for pathToSchemas for this test case") + val expectedPathToItem: MutableList = ArrayList() + expectedPathToItem.add("args[0]") + expectedPathToItem.add("someString") + val expectedClasses = LinkedHashMap, Nothing?>() + expectedClasses[JsonSchemaFactory.getInstance(StringJsonSchema.StringJsonSchema1::class.java)] = null + val expectedPathToSchemas = PathToSchemasMap() + expectedPathToSchemas[expectedPathToItem] = expectedClasses + assertEquals(pathToSchemas, expectedPathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithPropsSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyValueFails() { + val validator = PropertiesValidator() + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = 1 + val arg = FrozenMap(mutableMap) + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithPropsSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs new file mode 100644 index 00000000000..57bc81a2a3f --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/RequiredValidatorTest.hbs @@ -0,0 +1,110 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class RequiredValidatorTest { + interface ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchemaBoxedMap : ObjectWithRequiredSchemaBoxed + class ObjectWithRequiredSchema : JsonSchema( + JsonSchemaInfo() + .type(setOf(Map::class.java)) + .required(setOf("someString")) + ) { + override fun getNewInstance(arg: Any?, pathToItem: List, pathToSchemas: PathToSchemasMap): Any? { + if (arg is Map<*, *>) { + return getNewInstance(arg, pathToItem, pathToSchemas) + } + throw RuntimeException("Invalid input type=$javaClass. It can't be instantiated by this schema") + } + + @Throws(ValidationException::class) + override fun validate(arg: Any?, configuration: SchemaConfiguration?): Any? { + if (arg is Map<*, *>) { + return validate(arg, configuration) + } + throw ValidationException("Invalid input type=$javaClass. It can't be validated by this schema") + } + + @Throws(ValidationException::class) + override fun validateAndBox(arg: Any?, configuration: SchemaConfiguration?): ObjectWithRequiredSchemaBoxed { + return ObjectWithRequiredSchemaBoxedMap() + } + } + + @Test + @Throws(ValidationException::class) + fun testCorrectPropertySucceeds() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["someString"] = "abc" + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + @Throws(ValidationException::class) + fun testNotApplicableTypeReturnsNull() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val validator = RequiredValidator() + val pathToSchemas = validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + 1, + validationMetadata + ) + ) + assertNull(pathToSchemas) + } + + @Test + fun testIncorrectPropertyFails() { + val pathToItem = listOf("args[0]") + val validationMetadata = ValidationMetadata( + pathToItem, + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val mutableMap = LinkedHashMap() + mutableMap["aDifferentProp"] = 1 + val arg = FrozenMap(mutableMap) + val validator = RequiredValidator() + assertFailsWith( + block = { + validator.validate( + ValidationData( + ObjectWithRequiredSchema(), + arg, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file diff --git a/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs new file mode 100644 index 00000000000..eaf57b8a5d7 --- /dev/null +++ b/src/main/resources/kotlin/src/test/kotlin/packagename/schemas/validation/TypeValidatorTest.hbs @@ -0,0 +1,54 @@ +package {{{packageName}}}.schemas.validation + +import {{{packageName}}}.configurations.JsonSchemaKeywordFlags +import {{{packageName}}}.configurations.SchemaConfiguration +import {{{packageName}}}.exceptions.ValidationException +import {{{packageName}}}.schemas.StringJsonSchema + +import kotlin.test.Test +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class TypeValidatorTest { + @Test + @Throws(ValidationException::class) + fun testValidateSucceeds() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + val pathToSchemasMap = validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + "hi", + validationMetadata + ) + ) + assertNull(pathToSchemasMap) + } + + @Test + fun testValidateFailsIntIsNotString() { + val validator = TypeValidator() + val validationMetadata = ValidationMetadata( + ArrayList(), + SchemaConfiguration(JsonSchemaKeywordFlags.Builder().build()), + PathToSchemasMap(), + LinkedHashSet() + ) + assertFailsWith( + block = { + validator.validate( + ValidationData( + StringJsonSchema.StringJsonSchema1.getInstance(), + 1, + validationMetadata + ) + ) + } + ) + } +} \ No newline at end of file